robweir 00/02/10 12:45:43
Modified: src/org/apache/xalan/xslt ElemApplyImport.java
ElemForEach.java XSLTEngineImpl.java
src/org/apache/xalan/xslt/res XSLTErrorResources.java
Log:
Report an error if we try to process an xsl:apply-imports while we're
processing an xsl:for-each
Revision Changes Path
1.3 +5 -0 xml-xalan/src/org/apache/xalan/xslt/ElemApplyImport.java
Index: ElemApplyImport.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemApplyImport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemApplyImport.java 2000/01/05 23:05:30 1.2
+++ ElemApplyImport.java 2000/02/10 20:45:42 1.3
@@ -106,6 +106,11 @@
java.io.IOException,
SAXException
{
+ if (processor.m_inForEach >0)
+ {
+
processor.error(XSLTErrorResources.ER_NO_APPLY_IMPORT_IN_FOR_EACH);
//"xsl:apply-imports not allowed in a xsl:for-each");
+ }
+
super.execute(processor, sourceTree, sourceNode, mode);
if(null != sourceNode)
{
1.3 +27 -17 xml-xalan/src/org/apache/xalan/xslt/ElemForEach.java
Index: ElemForEach.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemForEach.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemForEach.java 2000/01/05 23:05:30 1.2
+++ ElemForEach.java 2000/02/10 20:45:42 1.3
@@ -113,22 +113,32 @@
java.io.IOException,
SAXException
{
- super.execute(processor, sourceTree, sourceNode, mode);
- if(null != sourceNode)
- {
- transformSelectedChildren(m_stylesheet,
- this,
- this,
- sourceTree,
- sourceNode, mode,
- m_selectPattern,
- Constants.ELEMNAME_FOREACH,
- processor);
- }
- else // if(null == sourceNode)
- {
- processor.error(this, sourceNode,
XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
- //"sourceNode is null in
handleApplyTemplatesInstruction!");
- }
+ processor.m_inForEach++;
+
+ try
+ {
+ super.execute(processor, sourceTree, sourceNode, mode);
+ if(null != sourceNode)
+ {
+ transformSelectedChildren(m_stylesheet,
+ this,
+ this,
+ sourceTree,
+ sourceNode, mode,
+ m_selectPattern,
+ Constants.ELEMNAME_FOREACH,
+ processor);
+ }
+ else // if(null == sourceNode)
+ {
+ processor.error(this, sourceNode,
XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
+ //"sourceNode is null in
handleApplyTemplatesInstruction!");
+ }
+ }
+
+ finally
+ {
+ processor.m_inForEach--;
+ }
}
}
1.34 +5 -0 xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java
Index: XSLTEngineImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- XSLTEngineImpl.java 2000/01/31 08:29:42 1.33
+++ XSLTEngineImpl.java 2000/02/10 20:45:42 1.34
@@ -366,6 +366,11 @@
* @see ElemNumber
*/
private transient CountersTable m_countersTable = null;
+
+ /**
+ * Is >0 when we're processing a for-each
+ */
+ int m_inForEach = 0;
/**
* Get the table of counters, for optimized xsl:number support.
1.16 +6 -1
xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.java
Index: XSLTErrorResources.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xslt/res/XSLTErrorResources.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- XSLTErrorResources.java 2000/02/08 15:36:19 1.15
+++ XSLTErrorResources.java 2000/02/10 20:45:43 1.16
@@ -20,7 +20,7 @@
public static final String ERROR_SUFFIX = "ER";
public static final String WARNING_SUFFIX = "WR";
-public static final int MAX_CODE = 94; // this is needed to
keep track of the number of messages
+public static final int MAX_CODE = 95; // this is needed to
keep track of the number of messages
public static final int MAX_WARNING = 23; // this is needed to
keep track of the number of warnings
public static final int MAX_OTHERS = 41;
public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
@@ -529,6 +529,11 @@
public static final int ER_CHOOSE_REQUIRES_WHEN = 94;
static {contents[ER_CHOOSE_REQUIRES_WHEN][1]
= "xsl:choose requires an xsl:when";
+}
+
+public static final int ER_NO_APPLY_IMPORT_IN_FOR_EACH = 95;
+static {contents[ER_NO_APPLY_IMPORT_IN_FOR_EACH][1]
+ = "xsl:apply-imports not allowed in a xsl:for-each";
}
// Warnings...