[ https://issues.apache.org/jira/browse/XALANC-720?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149618#comment-13149618 ]
Mukul Gandhi commented on XALANC-720: ------------------------------------- I agree that providing such a facility may be useful for users. At least with java, the JVM on stackoverflow error tells in stack trace where (by pointing to the line number) in the java source code the infinite recursion occurred, and this information might be exposed at the XSLT level. Such a modification to the product at today's date may be easily possible and with minimal risks, if the product's existing internal design is adaptable to such a change easily. If for e.g, the XSLT stylesheet is converted into an intermediate instruction set (which is some form of java object model in case of Xalan-J) and line numbers are not preserved in the intermediate form, then adding such a modification may carry risks of affecting other parts of the XSLT transformer if not done carefully and not tested enough. I'm just pondering on a preferred design (which I assume already exists) of the product, to easily allow us to accomplish this change with minimal risks; and certainly the Xalan product might allow us to accomplish such a change easily (and of-course if committers have will and see benefit in such change :). > Transformation can get stuck in an infinite loop > ------------------------------------------------ > > Key: XALANC-720 > URL: https://issues.apache.org/jira/browse/XALANC-720 > Project: XalanC > Issue Type: Bug > Components: XalanC > Affects Versions: 1.10 > Environment: Linux x86 (both 32 and 64-bit) - seen on RHEL 6, Unbuntu > and SLES > Reporter: Scott Exton > Assignee: Brian Minchau > > The XalanTransformer::transform function will get stuck in an infinite loop > for certain stylesheets. This problem occurs if you execute the following > command (using the sample programs): > XalanTransform test.xml test.xsl test.out, with the following file contents: > -- test-xml > <?xml version="1.0" > encoding='UTF-8'?><HTTPResponse><ResponseLine><Version>HTTP/1.1</Version><StatusCode>401</StatusCode><Reason>Unauthorized</Reason></ResponseLine><Headers><Header > name="content-length">1244</Header><Header > name="content-type">text%2Fhtml</Header><Header > name="date">Thu,%2010%20Nov%202011%2004%3A21%3A08%20GMT</Header><Header > name="cache-control">no-cache</Header><Header > name="pragma">no-cache</Header></Headers><Cookies></Cookies></HTTPResponse> > -- test.xsl > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:strip-space elements="*" /> > <xsl:output method="xml" omit-xml-declaration="no" encoding="UTF-8" > indent="yes" /> > <!-- Initially we start with a copy of the document. --> > <xsl:template match="@* | node()"> > <xsl:copy> > <xsl:apply-templates select="@* | node()" /> > </xsl:copy> > </xsl:template> > <!-- Add a new header if it doesn't exist --> > <xsl:template match="//HTTPResponse/Headers/Header"> > <xsl:choose> > <xsl:when test="@name='cache-control'"> > <Header Name="hdr-2">val-2</Header> > </xsl:when> > <xsl:otherwise> > </xsl:otherwise> > </xsl:choose> > <xsl:apply-templates select="//HTTPResponse/Headers/Header"/> > </xsl:template> > </xsl:stylesheet> > -- > In this instance the XalanTransform binary will never complete. The problem > stems from the '<xsl:apply-templates > select="//HTTPResponse/Headers/Header"/>' line. If this line is removed from > the XSLT everything works correctly. So, the XSLT is probably malformed, but > the program still shouldn't get stuck in an infinite loop. > Unfortunately I don't know the xalan-c code at all, but I have managed to > work out that we get stuck in the ElemTemplateElement::execute() function. > The following condition, > currentElement->getInvoker(executionContext) == invoker, is never met, which > means that we never break out of the loop. > Any help would be appreciated. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org For additional commands, e-mail: xalan-dev-h...@xml.apache.org