Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
2.3Dx
-
None
-
None
-
Operating System: Other
Platform: Other
-
9151
Description
javax.xml.transform.TransformerException: Unknown error in XPath
at org.apache.xpath.XPath.bool(XPath.java:411)
This error we get when evaluating <xsl:if test="$value!=''"> in
following stylesheet. This error happens randomly.
We
<xsl:template name="tg-val-attr-tbl">
<xsl:param name="tag"/>
<xsl:variable name="value">
<xsl:apply-templates select="." mode="tg-val">
<xsl:with-param name="tag" select="$tag" />
</xsl:apply-templates>
</xsl:variable>
<xsl:if test="$value!=''">
<xsl:attribute name="{$tag}">
<xsl:variable name="table"><xsl:call-template name="table-
name"/></xsl:variable>
<xsl:if test="$table!=''">
<xsl:value-of select="$table"/>
<xsl:text>.</xsl:text>
</xsl:if>
<xsl:value-of select="$value"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
we use this code to invoke xalan:
public void generate(String xsl) {
TransformerFactory tf = TransformerFactory.newInstance();
try {
Transformer tr = tf.newTransformer(new
javax.xml.transform.stream.StreamSource(getClass().getClassLoader
().getResourceAsStream(xsl), getClass().getClassLoader().getResource
(xsl).toExternalForm()));
Object classes[] = this.classes.getSelectedValues();
java.io.StringWriter out = new java.io.StringWriter();
for(int i = 0; classes!=null && i<classes.length; ++i)
System.out.println("Done! \n"+out);
} catch (TransformerConfigurationException e)
catch (TransformerException e)
{ System.err.println ("Location: "+com.bs.exceptions.ExceptionHistory.getLocactionAsString(e)); System.err.println(com.bs.exceptions.ExceptionHistory.getStackTrace (e)); }}
The stack trace:
Location: ; SystemID: file:/E:/DEVEL/bslib2/com/bs/generator/xmi_desc_gen.xsl;
Line#: 210; Column#: 29
; SystemID: file:/E:/DEVEL/bslib2/com/bs/generator/xmi_desc_gen.xsl; Line#:
210; Column#: 29
javax.xml.transform.TransformerException: Unknown error in XPath
at org.apache.xpath.XPath.bool(XPath.java:411)
at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:198)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemTemplate.execute
(ElemTemplate.java:432)
at org.apache.xalan.templates.ElemCallTemplate.execute
(ElemCallTemplate.java:279)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemForEach.transformSelectedNodes
(ElemForEach.java:438)
at org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:299)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode
(TransformerImpl.java:2069)
at org.apache.xalan.transformer.TransformerImpl.transformNode
(TransformerImpl.java:1171)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:634)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1088)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1066)
at com.bs.generator.ClassXMIChooser.generate(ClassXMIChooser.java:282)
at com.bs.generator.ClassXMIChooser.generateRes
(ClassXMIChooser.java:268)
at com.bs.generator.ClassXMIChooser.b_resActionPerformed
(ClassXMIChooser.java:168)
at com.bs.generator.ClassXMIChooser.access$400(ClassXMIChooser.java:26)
at com.bs.generator.ClassXMIChooser$5.actionPerformed
(ClassXMIChooser.java:123)
at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1450)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed
(AbstractButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:250)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased
(BasicButtonListener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2451)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:926)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
---------
java.lang.NullPointerException
at org.apache.xpath.objects.XRTreeFrag.xstr(XRTreeFrag.java:256)
at org.apache.xpath.objects.XRTreeFrag.equals(XRTreeFrag.java:355)
at org.apache.xpath.objects.XObject.notEquals(XObject.java:707)
at org.apache.xpath.operations.NotEquals.operate(NotEquals.java:82)
at org.apache.xpath.operations.Operation.execute(Operation.java:146)
at org.apache.xpath.Expression.bool(Expression.java:208)
at org.apache.xpath.XPath.bool(XPath.java:388)
at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:198)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemTemplate.execute
(ElemTemplate.java:432)
at org.apache.xalan.templates.ElemCallTemplate.execute
(ElemCallTemplate.java:279)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemForEach.transformSelectedNodes
(ElemForEach.java:438)
at org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:299)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode
(TransformerImpl.java:2069)
at org.apache.xalan.transformer.TransformerImpl.transformNode
(TransformerImpl.java:1171)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:634)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1088)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1066)
at com.bs.generator.ClassXMIChooser.generate(ClassXMIChooser.java:282)
at com.bs.generator.ClassXMIChooser.generateRes
(ClassXMIChooser.java:268)
at com.bs.generator.ClassXMIChooser.b_resActionPerformed
(ClassXMIChooser.java:168)
at com.bs.generator.ClassXMIChooser.access$400(ClassXMIChooser.java:26)
at com.bs.generator.ClassXMIChooser$5.actionPerformed
(ClassXMIChooser.java:123)
at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1450)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed
(AbstractButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:250)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased
(BasicButtonListener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2451)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:926)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
java.lang.NullPointerException
at org.apache.xpath.objects.XRTreeFrag.xstr(XRTreeFrag.java:256)
at org.apache.xpath.objects.XRTreeFrag.equals(XRTreeFrag.java:355)
at org.apache.xpath.objects.XObject.notEquals(XObject.java:707)
at org.apache.xpath.operations.NotEquals.operate(NotEquals.java:82)
at org.apache.xpath.operations.Operation.execute(Operation.java:146)
at org.apache.xpath.Expression.bool(Expression.java:208)
at org.apache.xpath.XPath.bool(XPath.java:388)
at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:198)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemTemplate.execute
(ElemTemplate.java:432)
at org.apache.xalan.templates.ElemCallTemplate.execute
(ElemCallTemplate.java:279)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemForEach.transformSelectedNodes
(ElemForEach.java:438)
at org.apache.xalan.templates.ElemForEach.execute(ElemForEach.java:299)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.templates.ElemLiteralResult.execute
(ElemLiteralResult.java:710)
at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes
(ElemApplyTemplates.java:422)
at org.apache.xalan.templates.ElemApplyTemplates.execute
(ElemApplyTemplates.java:226)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates
(TransformerImpl.java:2243)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode
(TransformerImpl.java:2069)
at org.apache.xalan.transformer.TransformerImpl.transformNode
(TransformerImpl.java:1171)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:634)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1088)
at org.apache.xalan.transformer.TransformerImpl.transform
(TransformerImpl.java:1066)
at com.bs.generator.ClassXMIChooser.generate(ClassXMIChooser.java:282)
at com.bs.generator.ClassXMIChooser.generateRes
(ClassXMIChooser.java:268)
at com.bs.generator.ClassXMIChooser.b_resActionPerformed
(ClassXMIChooser.java:168)
at com.bs.generator.ClassXMIChooser.access$400(ClassXMIChooser.java:26)
at com.bs.generator.ClassXMIChooser$5.actionPerformed
(ClassXMIChooser.java:123)
at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1450)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed
(AbstractButton.java:1504)
at javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:250)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased
(BasicButtonListener.java:216)
at java.awt.Component.processMouseEvent(Component.java:3715)
at java.awt.Component.processEvent(Component.java:3544)
at java.awt.Container.processEvent(Container.java:1164)
at java.awt.Component.dispatchEventImpl(Component.java:2593)
at java.awt.Container.dispatchEventImpl(Container.java:1213)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2451)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
at java.awt.Container.dispatchEventImpl(Container.java:1200)
at java.awt.Window.dispatchEventImpl(Window.java:926)
at java.awt.Component.dispatchEvent(Component.java:2497)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy
(EventDispatchThread.java:131)
at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:98)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)