-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
5.0
-
x86
-
windows_xp
Name: gm110360 Date: 06/22/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b56)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b56, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 5.2.3790]
A DESCRIPTION OF THE PROBLEM :
an XSLT template with match="and" results in the following exception:
ERROR: 'Syntax error in 'and'.'
FATAL ERROR: 'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
match="and" should match an element whoose name is "and". Apparently it is being treated as the logical operator "and" that appears in the "Predicate" part of an XPath location path.
A similar thing happens with match="or".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to use an XSLT transformation with a template that matches the element "and" or the element "or", such as:
<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="and"/>
</xsl:transform>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<xsl:template match="and">
should match an element whoose name is "and"
<xsl:template match="or">
should match an element whoose name is "or"
ACTUAL -
ERROR: 'Syntax error in 'and'.'
FATAL ERROR: 'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
ERROR: 'Syntax error in 'and'.'
FATAL ERROR: 'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.io.StringReader;
public class XSLT{
public static void main(String[] args) throws Exception{
Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(
"<?xml version=\"1.0\"?>"
+"<xsl:transform version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">"
+"<xsl:template match=\"and\"/>"
+"</xsl:transform>"
)));
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 280636)
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b56)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b56, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 5.2.3790]
A DESCRIPTION OF THE PROBLEM :
an XSLT template with match="and" results in the following exception:
ERROR: 'Syntax error in 'and'.'
FATAL ERROR: 'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
match="and" should match an element whoose name is "and". Apparently it is being treated as the logical operator "and" that appears in the "Predicate" part of an XPath location path.
A similar thing happens with match="or".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to use an XSLT transformation with a template that matches the element "and" or the element "or", such as:
<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="and"/>
</xsl:transform>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<xsl:template match="and">
should match an element whoose name is "and"
<xsl:template match="or">
should match an element whoose name is "or"
ACTUAL -
ERROR: 'Syntax error in 'and'.'
FATAL ERROR: 'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
ERROR: 'Syntax error in 'and'.'
FATAL ERROR: 'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import java.io.StringReader;
public class XSLT{
public static void main(String[] args) throws Exception{
Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(
"<?xml version=\"1.0\"?>"
+"<xsl:transform version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">"
+"<xsl:template match=\"and\"/>"
+"</xsl:transform>"
)));
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 280636)
======================================================================