This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Filtering 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]