Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2545

pipeDocument ignores nested stylesheet directed termination

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.7.1
    • None
    • Xalan-extensions
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • PatchAvailable

    Description

      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

      Attachments

        1. xalan-j2-XALANJ-1769.patch.txt
          2 kB
          Archie Cobbs

        Activity

          People

            Unassigned Unassigned
            archie172 Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: