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

RE: How to filter element values...

Subject: RE: How to filter element values...
From: "Josh Canfield" <Josh.Canfield@xxxxxxxxxxxx>
Date: Wed, 11 Feb 2004 09:30:31 -0800
xsl filter nodes
Thanks Ken, for helping me clear this up. The fact that the spec specifically says "This template rule applies to both element nodes and the root node." and doesn't mention the leaf nodes with respect to modes was throwing me off. Since reaching a leaf node would essentially end any recursion I assumed they were intentionally left out of moded matching...

I'm satisfied now, Thanks again,
Josh
-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of G. Ken Holman
Sent: Tuesday, February 10, 2004 6:13 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  How to filter element values...


At 2004-02-10 16:56 -0800, Josh Canfield wrote:
>I could be reading it wrong, but I don't think that section covers the 
>behavior that I am seeing.

I believe it is covered by the very first sentence of 5.8, even though 
there isn't an example of the processing of leaf nodes in a mode.

There cannot be a situation where there is no template anywhere for any 
mode, so the first sentence implicitly includes processing leaf nodes in a 
mode.

5.8 starts: "There is a built-in template rule to allow recursive 
processing to continue in the absence of a successful pattern match by an 
explicit template rule in the stylesheet." ... therefore if the stylesheet 
is absent a successful pattern match for a text node in a mode, there must 
be a built-in template rule.  And the built-in template rule for text nodes 
adds the node to the result tree.  I think it is just missing detail to 
spell that out in the document.

>I would expect this stylesheet:
>
><?xml version="1.0" ?>
><xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
>   <xsl:template match="/">
>         <MISSING_MODE>
>         <xsl:apply-templates mode="MISSING_MODE"/>
>         </MISSING_MODE>
>   </xsl:template>
></xsl:stylesheet>
>
>to output:
>
><MISSING_MODE>
></MISSING_MODE>

That would require an empty template rule for the text() node .. not an 
absent template rule.  I don't think an absent rule should imply "do 
nothing", therefore, I think the spec successfully covers the need for 
processing text() nodes in any mode by adding their content to the result tree.

>Both Xalan and Saxon behave as though there is a built-in text and 
>attribute template that is equivalent to:
>
><xsl:template match="text()|@*" mode="m">
>   <xsl:value-of select="."/>
></xsl:template>

I believe this to be implied by the first sentence, and I have documented 
it as such since day one in my XSLT training material, and I chose to 
include in the material an illustration of the template rules for leaf 
nodes in a mode.

................. Ken


--
Public courses: upcoming world tour of hands-on XSL training events
Each week:    Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO
Washington, DC: 2004-03-15            San Francisco, CA: 2004-03-22
Hong Kong: 2004-05-17    Germany: 2004-05-24    England: 2004-06-07
World-wide on-site corporate, government & user group XML training!

G. Ken Holman                  mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.           http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0     +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness   http://www.CraneSoftwrights.com/s/bc


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.