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

Determined to grok the built-in templates

Subject: Determined to grok the built-in templates
From: Sebastian Tennant <sebyte@xxxxxxxxxxxxxxx>
Date: Fri, 03 Feb 2006 23:00:57 +0000
probably already determined
Given:

  <text>
    foo
  </text>

and this XSLT:

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

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

the output is:

  template-match="/"

  template-match="*"

  foo

I believe I'm right in saying that together these two templates
overide(?) the built-in 'traversal' template, so precisely three templates
are in play; these two (above), and the 'text-copy' template:

  <xsl:template match="text()|@*">
    <xsl:value-of select=".">
  </xsl:template>

I'm probably already labouring under a miscomprehension of some sort,
but here's my understanding of the sequence of events:

#   Template        Current node-set          Result tree
-   --------        ----------------          -----------
1.  "/"             <text>foo</text>          template-match="/"
2.  "*"             [unchanged]             + template-match="*"
3.  'text-copy'     [unchanged]             + foo

Notes:

1. "/" is the best match, so it goes first, the <text> element (and
   its string value) becomes the current node set and the literal
   result text is appended to the result tree.

2. "*" comes next (not sure why) but as the <text> element has no
   children the current node set is unchanged, and the literal result
   element is appended to the result tree.

3. the 'text-copy' template brings up the rear and the text from the
   current node set is appended to the result tree.


How wrong am I?  :-/  Please don't say completely!

sdt

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.