You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Brian D. Kresge" <bk...@rochester.rr.com> on 2002/03/30 04:34:30 UTC
XSLTC and ArrayIndexOutOfBoundsException
Hi all-
I am hoping I am just missing something here. I am very excited to be
working with XSLTC; as it alleviates alot of performance problems related to
XML/XSL transformations...
I am having problems with some of my XML/XSL combinations. My initial
findings would seem to conclude that this problem manifests itself with
smaller DOM's, and the use of the XPath expression "//@some-attribute". I
have attempted to document a very small test that I put together to
demonstrate the problem.
Something of interest; changing the line in the XSL "<xsl:value-of
select="//@attr"/>" has different (and unexpected) results:
1) Changing to "<xsl:value-of select="//Root/InnerElement/@attr"/>" returns
nothing (but no exception is thrown)
2) Changing to "<xsl:value-of select="/Root/InnerElement/@attr"/>" works
If anyone has any idea as to what I may be doing wrong, or if I have
stumbled over a new bug of some sort; I would be very appreciative.
Thanks,
Brian Kresge
SW Engineer
=== Transformer Factory In Use ===
"org.apache.xalan.xsltc.trax.TransformerFactoryImpl" used for underlying
TransformerFactory implementation.
=== Java Code Snippet ===
TransformerFactory o_factory = TransformerFactory.newInstance();
Transformer o_transformer = o_factory.newTransformer(new
StreamSource("C:\\testing.xsl") );
StringWriter o_sw = new StringWriter();
PrintWriter o_pw = new PrintWriter( o_sw );
o_transformer.transform( new DOMSource(o_dom), new StreamResult(o_pw) );
=== XML DOM ===
<Root><InnerElement attr='Hello There'/></Root>
=== XSL Stylesheet ===
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="//@attr"/>
</xsl:template>
</xsl:stylesheet>
=== THE EXCEPTION ===
ERROR:
javax.xml.transform.TransformerException:
java.lang.ArrayIndexOutOfBoundsException
at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:5
47)
at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:1
79)
at com.grsi.util.cache.Tester.main(Tester.java:103)
---------
java.lang.ArrayIndexOutOfBoundsException
at
org.apache.xalan.xsltc.dom.DOMImpl$TypedAttributeIterator.setStartNode(DOMIm
pl.java:989)
at org.apache.xalan.xsltc.dom.StepIterator.next(StepIterator.java:140)
at
org.apache.xalan.xsltc.dom.DupFilterIterator.setStartNode(DupFilterIterator.
java:127)
at
org.apache.xalan.xsltc.dom.AbsoluteIterator.setStartNode(AbsoluteIterator.ja
va:90)
at
org.apache.xalan.xsltc.dom.DupFilterIterator.setStartNode(DupFilterIterator.
java:123)
at testing.applyTemplates()
at testing.transform()
at
org.apache.xalan.xsltc.runtime.AbstractTranslet.transform(AbstractTranslet.j
ava:547)
at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:5
39)
at
org.apache.xalan.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:1
79)
at com.grsi.util.cache.Tester.main(Tester.java:103)