Martin Honnen created XALANJ-2787:
-------------------------------------

             Summary: java.lang.StackOverflowError with except operator in XSLT 
3 code
                 Key: XALANJ-2787
                 URL: https://issues.apache.org/jira/browse/XALANJ-2787
             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: Windows 11, Java 8
            Reporter: Martin Honnen
         Attachments: except-input-sample2.xml, except-test2.xsl

This is a bug report on the XSLT 3.0 development branch of Xalan.

I have tried to use the newly implemented `except` operator but get a 
java.lang.StackOverflowError with a simple test case that runs fine with Saxon 
HE 12 Java.

XSLT code:

 
{code:java}
<?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="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="/*">
    <xsl:copy>
      <xsl:apply-templates select="* except (foo, bar)"/>
    </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}
 

XML input sample:
{code:java}
<root>
  <foo>foo 1</foo>
  <bar>bar 1</bar>
  <baz>baz 1</baz>
  <foo>foo 2</foo>
  <baz>baz 2</baz>
</root>{code}
Result with Xalan:

 
{noformat}
file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/except-test2.xsl;
 Zeilennummer17; Spaltennummer58; Erwartet wurde ), gefunden wurde: ,
file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/except-test2.xsl;
 Zeilennummer17; Spaltennummer58; Erwartet wurde ), gefunden wurde: ,
(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}
Result with Saxon:

 
{code:java}
<?xml version="1.0" encoding="UTF-8"?>                                          
  <root>                                       
   <baz>baz 1</baz>
   <baz>baz 2</baz>
</root>
<!--Run with Saxonica at 2024-10-02T13:35:37.9336156+02: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

Reply via email to