JDK-8058152 : JDK accepts XSLT stylesheet having import element erroneously placed
  • Type: Bug
  • Component: xml
  • Sub-Component: javax.xml.transform
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-09-10
  • Updated: 2017-05-17
  • Resolved: 2016-10-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b141Fixed
Sub Tasks
JDK-8175123 :  
Description
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