You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Martin Honnen (Jira)" <ji...@apache.org> on 2023/12/13 08:24:00 UTC

[jira] [Created] (XALANJ-2717) Identity transformation template with apply-templates select="(@*, node())" gives NullPointerException

Martin Honnen created XALANJ-2717:
-------------------------------------

             Summary: Identity transformation template with apply-templates select="(@*, node())" gives NullPointerException
                 Key: XALANJ-2717
                 URL: https://issues.apache.org/jira/browse/XALANJ-2717
             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


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

According to its documentation it supports the XPath 2 and later "comma" operator to form sequences and Mukul in an email on the Xalan user list explained me that such expressions need to be written as e.g. (a, b) instead of simply a, b.

Following that advice I used a simple test stylesheet that instead of apply-templates select="@* | node()" uses apply-templates select="(@* , node())", to express the identity transformation template how it is sometimes done in XSLT 2 and 3.

The complete code is 

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

 

run that against a sample input like
{code:java}
<root>
  <p>This is a test.</p>
</root>{code}
and you get a NullPointerException: " line number 9; column number 52; java.lang.NullPointerException".

 

I would expect the code to run without problems and return the input document unchanged.

 



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

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