Martin Honnen created XALANJ-2762:
-------------------------------------

             Summary: NullPointerException in XSLT 3 code
                 Key: XALANJ-2762
                 URL: https://issues.apache.org/jira/browse/XALANJ-2762
             Project: XalanJ2
          Issue Type: Bug
      Security Level: No security risk; visible to anyone (Ordinary problems in 
Xalan projects.  Anybody can view the issue.)
          Components: Xalan, Xalan-CmdLine
    Affects Versions: The Latest Development Code
            Reporter: Martin Honnen
         Attachments: preserve-space-input-sample1.xml, 
preserve-space-sheet1.xsl

This is a bug report against the XSLT 3 development branch of Xalan.

I get a NullPointerException with XSLT 3 code that runs fine through Saxon HE 
12.
{noformat}
<?xml version="1.0" 
encoding="UTF-8"?>file:///C:/Users/marti/IdeaProjects/xalan-java/../../OneDrive/Documents/xslt/blog-xslt-3-by-example/xalan-xslt3-tests/preserve-space-sheet1.xsl;
 Zeilennummer11; Spaltennummer50; java.lang.NullPointerException{noformat}
 

XML:

 

 
{code:java}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example.application</groupId>
    <artifactId>sample-flow-app</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
                                                    
<java.version>17</java.version>
        <vaadin.version>24.3.8</vaadin.version>
        <playwright.version>1.43.0</playwright.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.1.4</version>
    </parent>
</project>
{code}
 

XSLT:

 
{code:java}
<xsl:stylesheet 
  version="3.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xs="http://www.w3.org/2001/XMLSchema";
  exclude-result-prefixes="xs">
  
  <xsl:param name="indent-no-spaces" as="xs:integer" select="4"/>
  
  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>
  <xsl:preserve-space elements="*"/>
  
  <xsl:output indent="no"/>
  
  <xsl:template match="text()[not(normalize-space())]">
    <xsl:value-of select="replace(., ' +', string-join((1 to 
(xs:integer($indent-no-spaces * count(ancestor::*))))!' ', ''))"/>
  </xsl:template>
  
  <xsl:template 
match="text()[not(normalize-space())][not(following-sibling::node())]" 
priority="10">
    <xsl:value-of select="replace(., ' +', string-join((1 to 
(xs:integer($indent-no-spaces * (count(ancestor::*) - 1))))!' ', ''))"/>
  </xsl:template>
  
</xsl:stylesheet>
{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