I have the following XSLT code that almost does what I want:
<xsl:variable name="scoredItems"
select=
".//item/attributes/scored[@value='true'] |
self::section[attributes/variable_name/@value='SCORE']/item |
.//item//variables//variable_name"/>
I want to change this to a more complicated boolean expression:
<xsl:variable name="scoredItems"
select=
".//item/attributes/scored[@value='true'] or
(self::section[variable_name/@value='SCORE']/item and
(not (.//item/attributes/scored[@value='false']))) or
.//item//variables//variable_name"/>
However, when I run this, I get the following error:
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:832)
at org.apache.xalan.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:618)
How do I fix this? (Note that I’m using XSLT 1.0.)
In my experience, the default exception thrown by XSLT in Java is not very helpful. You’ll need to implement an instance of
ErrorListenerand use its methods to capture and report the true XSLT problem. You can attach thisErrorListenerusing thesetErrorListenermethod of yourTransformerFactory.