pipeDocument ignores nested stylesheet directed termination 
------------------------------------------------------------

                 Key: XALANJ-2545
                 URL: https://issues.apache.org/jira/browse/XALANJ-2545
             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-extensions
    Affects Versions: 2.7.1
            Reporter: Archie Cobbs
         Attachments: xalan-j2-XALANJ-1769.patch.txt

Subject says it all. Here's a simple test case:

build.xml

<project name="xalanbug" default="xalanbug" basedir="."
  xmlns:dellroad="urn:org.dellroad.ant"
  xmlns:testng="urn:org.testng"
  xmlns:antcontrib="urn:net.sf.antcontrib">

    <target name="xalanbug">
        <xslt style="stylesheet.xsl" in="stylesheet.xsl" out="/dev/null">
            <param name="fail" expression="no"/>
            <factory name="org.apache.xalan.processor.TransformerFactoryImpl"/>
        </xslt>
        <echo message="Success"/>
    </target>
</project>

stylesheet.xml

<xsl:transform
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:pipe="http://xml.apache.org/xalan/PipeDocument";
  extension-element-prefixes="pipe" version="1.0">

    <xsl:param name="fail"/>

    <xsl:template match="/">
        <xsl:choose>
            <xsl:when test="$fail = 'yes'">
                <xsl:message terminate="yes">FATAL ERROR</xsl:message>
            </xsl:when>
            <xsl:otherwise>
                <pipe:pipeDocument source="stylesheet.xsl" target="output.xml">
                    <stylesheet href="stylesheet.xsl">
                        <param name="fail" value="yes"/>
                    </stylesheet>
                </pipe:pipeDocument>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

</xsl:transform>

Note: build should fail because the nested stylesheet throws an error. However, 
we get this instead:

Buildfile: build.xml

xalanbug:
     [xslt] Processing 
/home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl to /dev/null
     [xslt] Loading stylesheet 
/home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl
     [xslt] file:/home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl; 
Line #14; Column #46; FATAL ERROR
     [xslt] (Location of error unknown)Stylesheet directed termination
     [echo] Success

BUILD SUCCESSFUL
Total time: 0 seconds

With my patch applied, you get the correct behavior:

Buildfile: build.xml

xalanbug:
     [xslt] Processing 
/home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl to /dev/null
     [xslt] Loading stylesheet 
/home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl
     [xslt] /home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl:17:80: 
Fatal Error! FATAL ERROR Cause: java.lang.RuntimeException: FATAL ERROR
     [xslt] /home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl:17:80: 
Fatal Error! Fatal error during transformation Cause: Fatal error during 
transformation
     [xslt] Failed to process 
/home/archie/svn/eng/proj/e911/2trunk/XALAN/stylesheet.xsl

BUILD FAILED
Fatal error during transformation

Total time: 0 seconds


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to