DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9171>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9171

xsltc apply-imports selects both included template (impincl12)

           Summary: xsltc apply-imports selects both included template
                    (impincl12)
           Product: XalanJ2
           Version: CurrentCVS
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.xsltc
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


<xsl:apply-imports> should only select matching templates from an imported 
stylesheet. On conformance test impincl12, xsltc outputs

  C-title: Testing include
  E-title: Testing include

when only 

  E-title: Testing include

should be output.

In the main stylesheet, the following template

  <xsl:template match="title">
  <!-- This has import precedence over e.xsl, plus it's last -->
    MAIN title: <xsl:value-of select="."/>
    <xsl:apply-imports/>
  </xsl:template>

triggers the apply-imports on the title node. The only 
template that matches that is imported is in e.xsl, which 
is imported by c.xsl. There is a template for title nodes
in c.xsl, but it should not be invoked because it is not 
imported. The output from xsltc shows that the template 
matching on title in c.xsl was incorrectly invoked.

impincl12.xml
-------------
<?xml version="1.0"?> 
<doc>
<title>Testing include</title>
<author>Joe Jones</author>
<chapters>
<chapter num="1">know xsl</chapter>
<chapter num="2">love xsl</chapter>
</chapters>
</doc>

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

  <!-- FileName: impincl12 -->
  <!-- Document: http://www.w3.org/TR/xslt -->
  <!-- DocVersion: 19991116 -->
  <!-- Section: 2.6 -->
  <!-- Creator: David Marston -->
  <!-- Purpose: Show that apply-imports really means imports, not includes -->

<xsl:template match="/">
  <out><xsl:apply-templates select="doc/*" /></out>
</xsl:template>

<xsl:template match="author">
  MAIN author: <xsl:value-of select="."/>
</xsl:template>

<!-- INCLUDES can be anywhere and are positionally significant -->
<xsl:include href="c.xsl"/>

<xsl:template match="title"><!-- This has import precedence over e.xsl, plus
it's last -->
  MAIN title: <xsl:value-of select="."/>
  <xsl:apply-imports/>
</xsl:template>

</xsl:stylesheet>

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

<!-- FileName: c -->
<!-- Purpose: Used by impincl05, 06, 07, 12, 14 -->

<xsl:import href="e.xsl"/>

<xsl:template match="title">
  C-title: <xsl:value-of select="."/>
  <xsl:apply-imports/>
</xsl:template>

<xsl:template match="chapters">
  C-chapters: <xsl:apply-templates select="chapter"/>
  <xsl:text>&#10;</xsl:text>
</xsl:template>

</xsl:stylesheet>

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

<!-- FileName: e -->
<!-- Purpose: Used by c.xsl, which is used by several tests. -->

<xsl:template match="title">
  E-title: <xsl:value-of select="."/>
</xsl:template>

<xsl:template match="chapter">
    E-chapter <xsl:value-of select="@num"/><xsl:text>: </xsl:text>
  <xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>

Reply via email to