[ 
https://issues.apache.org/jira/browse/XALANJ-2718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17797245#comment-17797245
 ] 

Mukul Gandhi commented on XALANJ-2718:
--------------------------------------

@Martin, within the XSLT stylesheet recursive-key-use1.xsl that you've 
provided, if we make a modification (i.e, this is a workaround for your 
mentioned XSLT use case) as follows,

<xsl:template match="product">
    <xsl:copy>
      <xsl:variable name="keyVar1" select="key('child', @id)"/>
      <xsl:apply-templates select="(@*, node(), $keyVar1)"/>
    </xsl:copy>
</xsl:template>

i.e, we use an XSLT variable to refer to the XPath expression key('child', 
@id), and then referring that variable as follows :  (@*, node(), $keyVar1)

the XSLT transformation you've provided works fine with XalanJ's dev repos 
branch xalan-j_xslt3.0 codebase.

The XPath 3.1 parse of sequence constructor expression for e.g like (abc, pqr, 
mno), within XalanJ's dev repos branch xalan-j_xslt3.0, currently uses comma as 
a delimiter (i.e, this approach is not fully compliant with the XPath 3.1 
language grammar) of individual XPath expressions of the sequence constructor 
expression as a whole. Due to this limitation of XalanJ codebase on dev repos 
branch xalan-j_xslt3.0, your originally mentioned XPath expression (@*, node(), 
key('child', @id)) doesn't work with the XalanJ's dev repos branch 
xalan-j_xslt3.0 codebase.

> StackOverflow exception with recursive use of key function and comma operator
> -----------------------------------------------------------------------------
>
>                 Key: XALANJ-2718
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2718
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in 
> Xalan projects.  Anybody can view the issue.) 
>          Components: transformation, Xalan, Xalan-CmdLine
>    Affects Versions: The Latest Development Code
>            Reporter: Martin Honnen
>            Assignee: Gary D. Gregory
>            Priority: Major
>         Attachments: flat-product-list.xml, recursive-key-use1.xsl
>
>
> This is a bug report on the XSLT 3.0 development branch of XalanJ.
> I have written some XSLT 2/3 code making use of a key, recursion due to use 
> of the key function in apply-templates with a select attribute of the form 
> {code:java}
> <xsl:apply-templates select="(@*, node(), key('child', @id))"/>{code}
>  
> That spews out lots of errors/warnings about 
> {noformat}
> Line no 24, col number 70, expected ), found: ,{noformat}
> (that is my translation of the German error message I get)
> {noformat}
>  Zeilennummer24; Spaltennummer70; Erwartet wurde ), gefunden wurde: 
> ,{noformat}
> and finally terminates with
> {noformat}
> XSLT-error (java.lang.StackOverflowError): null
> Exception in thread "main" java.lang.RuntimeException
>         at org.apache.xalan.xslt.Process.doExit(Process.java:1158)
>         at org.apache.xalan.xslt.Process.main(Process.java:1131){noformat}
>  
> Other XSLT 3 processors like both Saxon Java and SaxonJS run the code fine 
> and produce a nested product list.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to