[ http://issues.apache.org/jira/browse/XALANJ-2347?page=all ]

Brian Minchau reassigned XALANJ-2347:
-------------------------------------

    Assignee: Henry Zongaro

Assiging to Henry Zongaro, who agreed to look at this one at
the Xalan-J JIRA triage on December 11, 2006

> xpath expression containing attribute test followed by or and the preceding 
> axis causes stack overflow.
> -------------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2347
>                 URL: http://issues.apache.org/jira/browse/XALANJ-2347
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: Xalan
>    Affects Versions: 2.7
>         Environment: Win XP, Xalan Java 2.7.0, java.version=1.5.0_06
>            Reporter: Robert Eaton
>         Assigned To: Henry Zongaro
>            Priority: Minor
>
> I have been getting a StackOverflowError when trying to perform an XSL 
> transformation using Xalan 2.7.0 with a styleshhet I had written. I have 
> simplified the the XSL and the problem seems to be related to an xpath 
> expression used in an if, but I can't see anything wrong with it.
> I was using this xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <docdef>
> <region name="Main Region">
> <section id="2" name="section1">
> <frag id="1" name="part1" type="text">
> <p style="body" align="left" xml:space="preserve">first paragraph.</p>
> </frag>
> <frag id="2" name="next fragment" type="text">
> <p style="inherit" align="center" xml:space="preserve">Paragraph with a style 
> of inherit but its own alignment , first in fragment.</p>
> <p style="inherit" xml:space="preserve"/>
> <p xml:space="preserve">Another paragraph</p>
> </frag>
> </section>
> </region>
> </docdef>
> with this xsl:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
> xmlns:fo="http://www.w3.org/1999/XSL/Format"; 
> xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"; 
> xmlns:aml="http://schemas.microsoft.com/aml/2001/core"; 
> xmlns:w10="urn:schemas-microsoft-com:office:word" 
> xmlns:v="urn:schemas-microsoft-com:vml" 
> xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"; 
> xmlns:o="urn:schemas-microsoft-com:office:office" >
> <xsl:template match="[EMAIL PROTECTED]'inherit']">
> <xsl:if test="not(preceding-sibling::*) or preceding-sibling::*[1] != 
> preceding-sibling::p[1]">
> <w:p>
> <w:pPr>
> <!-- This is the problem statement. The error does not occur if the  '@align 
> or' is removed from the start of the xpath.-->
> <xsl:if test="@align or 
> preceding::p[not(ancestor::table)][not(@style='inherit')][1]/@align">
> <xsl:element name="w:jc">
> <xsl:if test="@align">
> <xsl:attribute name="w:val"><xsl:value-of select="@align"/></xsl:attribute>
> </xsl:if>
> <xsl:if test="not(@align)">
> <xsl:attribute name="w:val">
> <xsl:value-of 
> select="preceding::p[not(ancestor::table)][not(@style='inherit')][1]/@align"/>
>  
> </xsl:attribute>
> </xsl:if>
> </xsl:element>
> </xsl:if>
> </w:pPr>
> <xsl:apply-templates/>
> </w:p>
> </xsl:if>
> </xsl:template>
> </xsl:stylesheet>
> The error message I get from Xalan is 
> (Location of error unknown)XSLT Error (java.lang.StackOverflowError): null 
> Exception in thread "main" java.lang.RuntimeException 
>         at org.apache.xalan.xslt.Process.doExit(Process.java:1153) 
>         at org.apache.xalan.xslt.Process.main(Process.java:1126) 
> If I do the transformation within XMLSpy it does not report any errors so it 
> seems to be something to do with Xalan.
> I have tried enabling various tracing options, see output below, but I get no 
> additional output.
> C:\xalan\xalan-j_2_7_0>java -Xmx128M -cp 
> c:\xalan\xalan-j_2_7_0\xalan.jar;c:\xal
> an\xalan-j_2_7_0\xml-apis.jar;c:\xalan\xalan-j_2_7_0\xercesImpl.jar 
> org.apache.x
> alan.xslt.Process -TT -in test.xml -xsl test.xsl -out out.xml
> (Location of error unknown)XSLT Error (java.lang.StackOverflowError): null
> Exception in thread "main" java.lang.RuntimeException
>         at org.apache.xalan.xslt.Process.doExit(Process.java:1153)
>         at org.apache.xalan.xslt.Process.main(Process.java:1126)
> I also tried -TG, -TS and -TTC and all give the same result as above.
> The results of running environement check are shown below.
> #---- BEGIN writeEnvironmentReport($Revision: 1.29 $): Useful stuff found: 
> ----
> version.DOM.draftlevel=2.0fd
> java.class.path=c:\xalan\xalan-j_2_7_0\xalan.jar;c:\xalan\xalan-j_2_7_0\xml-apis.jar;c:\xalan\xalan-j_2_7_0\xercesImpl.jar
> version.JAXP=1.1 or higher
> java.ext.dirs=C:\Program Files\Java\jre1.5.0_06\lib\ext
> version.xerces2=Xerces-J 2.7.1
> version.xerces1=not-present
> version.xalan2_2=Xalan Java 2.7.0
> version.xalan1=not-present
> version.ant=not-present
> java.version=1.5.0_06
> version.DOM=2.0
> version.crimson=not-present
> sun.boot.class.path=C:\Program Files\Java\jre1.5.0_06\lib\rt.jar;C:\Program 
> Files\Java\jre1.5.0_06\lib\i18n.jar;C:\Program 
> Files\Java\jre1.5.0_06\lib\sunrsasign.jar;C:\Program 
> Files\Java\jre1.5.0_06\lib\jsse.jar;C:\Program 
> Files\Java\jre1.5.0_06\lib\jce.jar;C:\Program 
> Files\Java\jre1.5.0_06\lib\charsets.jar;C:\Program 
> Files\Java\jre1.5.0_06\classes
> #---- BEGIN Listing XML-related jars in: foundclasses.java.class.path ----
> xalan.jar-path=c:\xalan\xalan-j_2_7_0\xalan.jar
> xml-apis.jar-apparent.version=xml-apis.jar from head branch of xml-commons, 
> tag: xml-commons-external_1_3_02
> xml-apis.jar-path=c:\xalan\xalan-j_2_7_0\xml-apis.jar
> xercesImpl.jar-apparent.version=xercesImpl.jar from Xerces-J-bin.2.7.1
> xercesImpl.jar-path=c:\xalan\xalan-j_2_7_0\xercesImpl.jar
> #----- END Listing XML-related jars in: foundclasses.java.class.path -----
> version.SAX=2.0
> version.xalan2x=Xalan Java 2.7.0
> #----- END writeEnvironmentReport: Useful properties found: -----
> # YAHOO! Your environment seems to be OK.
> I have also managed to get the error with a different but similar Xpath 
> expression. It seems to be a problem when it starts with "@align or 
> preceding" an attribute test followed by the ancestor axis does not seem to 
> cause a problem and if I remove the '@align or' from the begining and break 
> it up into multiple xsl:if statements it is okay. 
> I believe it is happening when the stylesheet it first passed before it 
> actually starts the transformation.  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to