xsl-list
[Top] [All Lists]

RE: firing on more than one match

2003-10-17 09:53:14
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'>
     [Result]
  </xsl:when>

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!

Lars


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



<Prev in Thread] Current Thread [Next in Thread>