Q: modes and implicit templates and XT-19990514

Subject: Q: modes and implicit templates and XT-19990514
From: "Larry Fitzpatrick" <lef@xxxxxxxxxxxx>
Date: Fri, 18 Jun 1999 18:01:22 -0400
Hi,

I am having trouble understanding a bit of behavior of xt-19990514.  Attached is a simple
document and 2 xsl transformations that are to restructure the document.

The basic issue is do modes apply to the implicit templates (in this example,
the one for text()).

The first script, test.xsl, has the following two statements in it:
    <xsl:apply-templates select="text()"/>
...
   <xsl:apply-templates mode="c" select="text()"/>

(in two different places, of course).

This script also has a template defined, for the moded text(), e.g.,

    <xsl:template match="text()" mode="c">
     foo bar baz
    </xsl:template>

The output is what I would have expected.

However, test2.xsl, has no template defined for moded text. The the following
statement:
   <xsl:apply-templates mode="c" select="text()"/>
selects the implicit, unmoded, text rule. This is not what I would have expected.

The spec says:
    "If an xsl:apply-templates element has a mode attribute, then it applies only to those template rules from xsl:template elements
that have a mode attribute with the same value"

This doesn't seem to be true for this implicit template. Is the spec or xt correct (or am I missing something
else)? Are the implicit rules treated especially for modes?

tx muchly,
lef


<!-- XSL to transform test2.xml into the appropriate format
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>

<xsl:template match="/">
 <Message>
  <xsl:apply-templates/>
 </Message>
</xsl:template>

<xsl:template match="quotation">
 <Object>
  <Meta>
   	<xsl:apply-templates select="text()"/>
  </Meta>
  <Content>
   <xsl:apply-templates mode="c" select="text()"/>
  </Content>
 </Object>
</xsl:template>

</xsl:stylesheet>
<!-- XSL to transform test2.xml into the appropriate format
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>

<xsl:template match="/">
 <Message>
  <xsl:apply-templates/>
 </Message>
</xsl:template>

<xsl:template match="quotation">
 <Object>
  <Meta>
   	<xsl:apply-templates select="text()"/>
  </Meta>
  <Content>
   <xsl:apply-templates mode="c" select="text()"/>
  </Content>
 </Object>
</xsl:template>

<xsl:template match="text()" mode="c">
	foo bar baz
</xsl:template>

</xsl:stylesheet>
<?xml version="1.0"?>
<!-- Test2 XML file 
-->

<quotations>

<quotation>
First things first, but not necessarily in that order.  
</quotation>

<quotation>The story so far: In the beginning the Universe was created.  
This has made a lot of people very angry and has been widely 
regarded as a bad move.  
</quotation>

<quotation>A book of quotations... can never be complete.  
</quotation>

</quotations>
Current Thread