[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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
quotation templates
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.