[ https://issues.apache.org/jira/browse/XALANJ-2801?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17937217#comment-17937217 ]
Joshua Marquart commented on XALANJ-2801: ----------------------------------------- See if XALANJ-2792 and XALANJ-2973 patches help. > java.lang.StackOverflowError with XPath step doing /. > ----------------------------------------------------- > > Key: XALANJ-2801 > URL: https://issues.apache.org/jira/browse/XALANJ-2801 > 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 > Environment: Java 8, Windows 11 > Reporter: Martin Honnen > Priority: Major > > This is a bug report on the XSLT 3 development branch of Xalan. > In XPath 2 and later, where you work with sequence that can contain > duplicates of nodes, a common technique to achieve de-duplication is to > append a step doing > {noformat} > /. > {noformat} > . > An attempt to run a test case for Xalan whether it supports that results in a > StackOverflowError. > Here is the code, first the XML: > {code:xml} > <root> > <foo>foo 1</foo> > <foo>foo 2</foo> > <foo>foo 3</foo> > </root> > {code} > then the XSLT: > {code:xml} > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="3.0" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > exclude-result-prefixes="xs"> > <xsl:output method="xml" indent="yes"/> > <xsl:template match="/*"> > <xsl:copy> > <children> > <xsl:sequence select="*"/> > </children> > <sequence-of-some-children> > <xsl:sequence select="(foo, foo)"/> > </sequence-of-some-children> > <de-duplicated-sequence-of-some-children> > <xsl:sequence select="(foo, foo)/."/> > </de-duplicated-sequence-of-some-children> > </xsl:copy> > </xsl:template> > <xsl:template match="/"> > <xsl:copy> > <xsl:apply-templates/> > <xsl:comment>Run with <xsl:value-of > select="system-property('xsl:vendor')"/> at <xsl:value-of > select="current-dateTime()"/></xsl:comment> > </xsl:copy> > </xsl:template> > </xsl:stylesheet> > {code} > Trying to run that with Xalan spews out a long list of errors for line 18 > that ")" was expected but "," found and finally > {noformat} > (Position des Fehlers unbekannt)XSLT-Fehler (java.lang.StackOverflowError): > null > Exception in thread "main" java.lang.RuntimeException > at org.apache.xalan.xslt.Process.doExit(Process.java:1176) > at org.apache.xalan.xslt.Process.main(Process.java:1149) > {noformat} > With Saxon 12 I get no errors and e.g. the output > {code:xml} > <?xml version="1.0" encoding="UTF-8"?> > <root> > <children> > <foo>foo 1</foo> > <foo>foo 2</foo> > <foo>foo 3</foo> > </children> > <sequence-of-some-children> > <foo>foo 1</foo> > <foo>foo 2</foo> > <foo>foo 3</foo> > <foo>foo 1</foo> > <foo>foo 2</foo> > <foo>foo 3</foo> > </sequence-of-some-children> > <de-duplicated-sequence-of-some-children> > <foo>foo 1</foo> > <foo>foo 2</foo> > <foo>foo 3</foo> > </de-duplicated-sequence-of-some-children> > </root> > <!--Run with Saxonica at 2025-03-20T17:13:32.9322917+01:00--> > {code} -- 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