RE: [xsl] firing on more than one match

Subject: RE: [xsl] firing on more than one match
From: "Lars Huttar" <lars_huttar@xxxxxxx>
Date: Fri, 17 Oct 2003 11:53:14 -0500
Hello Kent,

Ronald Kent Gibson wrote:

> I have something like this, ie there are more is more than 
> one node that is
> named ruledef, and I want my condition to fire when any of 
> these things are
> equal to the condition.
> <xsl:when test="/ruledef[1]/@pageeject = 'yes'">
> </xsl:when>

Taken literally, there can't be more than one node "/ruledef" in
an XML document, since there can only be one document node.

But assuming there are multiple ruledef nodes somewhere, the test
  <xsl:when test="ruledef/@pageeject = 'yes'>

will do what it seems you want: it will generate the [Result]
whenever *any* element (child of the current node in this case)
named "ruledef" has a "pageeject" attribute with the value "yes".

You don't need a loop; XPath semantics are like a database query,
with the "does any such thing exist" idea built in.

> I don't thinkr recursion will help, either. So can anyone 
> kindly give me
> some suggestions, thanks and enjoy the weekend.

You too!


 XSL-List info and archive:

Current Thread