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

Re: Filtering using XSL

Subject: Re: Filtering using XSL
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 10 Feb 2000 18:38:35 GMT
filtering nodes using xsl
> I thought it will work as ".//", will traverse the children's children 
> also...

It does, but just in the filter, not in the construction of the
nodelist.

You wrote

match="Main[  . . . ]"

so whatever you put inside the filter (ie inside the [] ) you will only
ever get a node list of elements called main, the ones for which the
filter expression is true) In your case the filter expression is true
for any Main elements that have a chapter descendednt with the specified
attribute. But as there is only one Main element this node list will have
length 0 or 1.

> I tried using   <xsl:template match = "Main//Chapter[@Value = 'false']"/>
> It is filtering all the direct children Chapters of Main which has attribute 
> value = 'true'

If it is doing that, report it as a bug to the author of your xsl
system.

> What i want is I want only Chapters(direct/indirect children 
> of Main) which has a Value = true..

so you want the expression you give.

However it is rather perverse to apply templates to _all_ nodes and then
use a complicated match for those nodes that you want (and presumably a
default template for the other cases that just recurses on the children)

It is more direct if you _only_ want to process those nodes to select
those nodes for processing as in

<xsl:template match="Main>
  <xsl:apply-templates select=".//Chapter[@Value = 'false']"/>
...

David


 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.