Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8058152

JDK accepts XSLT stylesheet having import element erroneously placed

XMLWordPrintable

      Let's consider following XSLT stylesheet:

          <?xml version="1.0" encoding="UTF-8"?>
          <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

            <xsl:template match="content">
             <html><xsl:apply-templates/></html>
            </xsl:template>
           
            <xsl:template match="content/title">
             <h1><xsl:apply-templates/></h1>
            </xsl:template>
           
            <xsl:import href="Test5footer.xsl"/>

          </xsl:stylesheet>

      RI (JDK8b132) for the present moment processes such XSLT stylesheet successfully, however according to W3C spec [1] error should be thrown because import elements are allowed to be placed in the beginning only:

          The xsl:import element children must precede all other element children of
          an xsl:stylesheet element, including any xsl:include element children.

      The minimized testcase is attached.
      In order to reproduce this bug:
      1. Unzip attached archive;
      2. Compile Test5.java source;
      3. Run Test5 class passing it full directory path where Test5* XML and XSL files are located.

      [1] http://www.w3.org/TR/xslt#import

            joehw Joe Wang
            grakov Georgiy Rakov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: