mmidy 00/02/08 07:36:20
Modified: src/org/apache/xalan/xslt ElemChoose.java
src/org/apache/xalan/xslt/res XSLTErrorResources.java
Log:
Error if no xsl:when for an xsl:choose
Revision Changes Path
1.4 +7 -1 xml-xalan/src/org/apache/xalan/xslt/ElemChoose.java
Index: ElemChoose.java
===================================================================
RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xslt/ElemChoose.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemChoose.java 2000/01/05 23:05:30 1.3
+++ ElemChoose.java 2000/02/08 15:36:19 1.4
@@ -100,12 +100,14 @@
SAXException
{
super.execute(processor, sourceTree, sourceNode, mode);
+ boolean found = false;
for (ElemTemplateElement node = (ElemTemplateElement)getFirstChild();
node != null; node = node.m_nextSibling)
{
int type = node.getXSLToken();
if(Constants.ELEMNAME_WHEN == type)
{
+ found = true;
ElemWhen when = (ElemWhen)node;
// must be xsl:when
XPathSupport execContext = processor.getXMLProcessorLiaison();
@@ -129,11 +131,15 @@
}
else if(Constants.ELEMNAME_OTHERWISE == type)
{
- // xsl:otherwise
+ // xsl:otherwise
node.executeChildren(processor, sourceTree,
sourceNode, mode);
}
}
+ if (found == false)
+ {
+ processor.error(XSLTErrorResources.ER_CHOOSE_REQUIRES_WHEN);
+ }
}
/**
1.15 +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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XSLTErrorResources.java 2000/02/04 15:59:43 1.14
+++ XSLTErrorResources.java 2000/02/08 15:36:19 1.15
@@ -20,7 +20,7 @@
public static final String ERROR_SUFFIX = "ER";
public static final String WARNING_SUFFIX = "WR";
-public static final int MAX_CODE = 93; // this is needed to
keep track of the number of messages
+public static final int MAX_CODE = 94; // 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;
@@ -524,6 +524,11 @@
public static final int ER_ILLEGAL_ATTRIBUTE_VALUE = 93;
static {contents[ER_ILLEGAL_ATTRIBUTE_VALUE][1]
= "Attribute: {0} has an illegal value: {1}";
+}
+
+public static final int ER_CHOOSE_REQUIRES_WHEN = 94;
+static {contents[ER_CHOOSE_REQUIRES_WHEN][1]
+ = "xsl:choose requires an xsl:when";
}
// Warnings...