jstrachan 2002/06/07 02:00:36
Modified: jelly/src/java/org/apache/commons/jelly/tags/jsl
StylesheetTag.java TemplateTag.java
jelly/src/java/org/apache/commons/jelly/tags/xml
XMLTagLibrary.java
jelly build.xml
Log:
Patched the JSL library so that its working properly again! Also added some extra
debug logging that makes it easier to debug if things break again.
Will add some JUnit test cases shortly to ensure that we can test if JSL breaks
again in the future.
Revision Changes Path
1.2 +11 -1
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jsl/StylesheetTag.java
Index: StylesheetTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jsl/StylesheetTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetTag.java 25 May 2002 18:27:21 -0000 1.1
+++ StylesheetTag.java 7 Jun 2002 09:00:36 -0000 1.2
@@ -61,8 +61,10 @@
import org.apache.commons.jelly.JellyException;
import org.apache.commons.jelly.XMLOutput;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.dom4j.Node;
-//import org.dom4j.XPath;
import org.dom4j.rule.Action;
import org.dom4j.rule.Rule;
import org.dom4j.rule.Stylesheet;
@@ -76,6 +78,10 @@
*/
public class StylesheetTag extends JSLTagSupport {
+ /** The Log to which logging calls will be made. */
+ private Log log = LogFactory.getLog(StylesheetTag.class);
+
+
/** Holds the stylesheet which will be applied to the source context. */
private Stylesheet stylesheet = new Stylesheet();
@@ -125,6 +131,10 @@
try {
// run the body to add the rules
getBody().run(context, output);
+
+ if ( log.isDebugEnabled() ) {
+ log.debug( "About to evaluate stylesheet on source: " + source );
+ }
stylesheet.setModeName( getMode() );
stylesheet.run( source );
1.2 +15 -1
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jsl/TemplateTag.java
Index: TemplateTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/jsl/TemplateTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TemplateTag.java 25 May 2002 18:27:21 -0000 1.1
+++ TemplateTag.java 7 Jun 2002 09:00:36 -0000 1.2
@@ -63,6 +63,9 @@
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.tags.xml.XPathSource;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.dom4j.Node;
import org.dom4j.rule.Action;
import org.dom4j.rule.Pattern;
@@ -76,6 +79,10 @@
*/
public class TemplateTag extends JSLTagSupport implements XPathSource {
+ /** The Log to which logging calls will be made. */
+ private Log log = LogFactory.getLog(TemplateTag.class);
+
+
/** Holds value of property name. */
private String name;
@@ -114,6 +121,10 @@
if (tag == null) {
throw new JellyException( "This <template> tag must be used inside a
<stylesheet> tag" );
}
+
+ if ( log.isDebugEnabled() ) {
+ log.debug( "adding template rule for match: " + match );
+ }
Rule rule = getRule();
if ( rule != null && tag != null) {
@@ -216,7 +227,10 @@
return new Action() {
public void run(Node node) throws Exception {
xpathSource = node;
-
+
+ if (log.isDebugEnabled()) {
+ log.debug( "Firing template body for match: " + match + " and
node: " + node );
+ }
getBody().run(context, output);
}
};
1.8 +6 -6
jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java
Index: XMLTagLibrary.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLTagLibrary.java 30 May 2002 12:15:25 -0000 1.7
+++ XMLTagLibrary.java 7 Jun 2002 09:00:36 -0000 1.8
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
1.7 2002/05/30 12:15:25 jstrachan Exp $
- * $Revision: 1.7 $
- * $Date: 2002/05/30 12:15:25 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v
1.8 2002/06/07 09:00:36 jstrachan Exp $
+ * $Revision: 1.8 $
+ * $Date: 2002/06/07 09:00:36 $
*
* ====================================================================
*
@@ -57,7 +57,7 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * $Id: XMLTagLibrary.java,v 1.7 2002/05/30 12:15:25 jstrachan Exp $
+ * $Id: XMLTagLibrary.java,v 1.8 2002/06/07 09:00:36 jstrachan Exp $
*/
package org.apache.commons.jelly.tags.xml;
@@ -83,7 +83,7 @@
/** Describes the Taglib. This class could be generated by XDoclet
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class XMLTagLibrary extends TagLibrary {
@@ -124,6 +124,6 @@
}
// will use the default expression instead
- return null;
+ return super.createExpression(factory, tagName, attributeName,
attributeValue);
}
}
1.37 +16 -0 jakarta-commons-sandbox/jelly/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/jelly/build.xml,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- build.xml 6 Jun 2002 07:13:41 -0000 1.36
+++ build.xml 7 Jun 2002 09:00:36 -0000 1.37
@@ -256,6 +256,22 @@
</target>
+ <target name="demo.jsl.debug" depends="compile"
+ description="Runs a simple demo of the JSL tags with debugging on">
+
+ <jelly file="src/test/org/apache/commons/jelly/jsl/example.jelly"/>
+
+ <java classname="org.apache.commons.jelly.Jelly" fork="yes">
+ <classpath refid="test.classpath"/>
+ <arg value="src/test/org/apache/commons/jelly/jsl/example.jelly"/>
+
+ <!-- turn on debugging -->
+ <sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
value="debug"/>
+ <sysproperty
key="org.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester"
value="warn"/>
+ <sysproperty
key="org.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester.sax"
value="warn"/>
+ </java>
+ </target>
+
<target name="demo.jsl2" depends="compile"
description="Runs demo #2 of the JSL tags">
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>