|
Subject: Re: [xsl] testing for text in one of many elements From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 19 Jun 2003 16:29:13 +0100 |
Hi Mattison,
> In psuedo-code I want to be like this:
>
> <xsl:if test="IfOneOfTheFunctionTagsHasThisValue('Function Uno')">
> <a href="function_one.asp">Func One</a>
> </xsl:if>
The IfOneOfTheFunctionTagsHasThisValue('Function Uno') test can be
written:
Function = 'Function Uno'
When you use = in XPath and one of the operands is a node-set (in
this case a node-set of <Function> elements), then the test returns
true if *any* of the nodes in the node-set have the value of the other
operand.
If you prefer, you can alternatively use:
Function[. = 'Function Uno']
Effectively, this filters the node-set of <Function> elements to
include only those whose value is 'Function Uno'. If the resulting
node-set has any nodes in it, then the result of the test is true; if
the resulting node-set is empty, then the result of the test is false.
In the current version of XPath 2.0, you can make this more explicit
by using:
some $f in Function satisfies $f eq 'Function Uno'
but it's a bit long-winded in my opinion.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] testing for text in one o, Marty McKeever | Thread | RE: [xsl] testing for text in one o, Stuart Brown |
| RE: [xsl] testing for text in one o, Marty McKeever | Date | Re: [xsl] DOM and XPath Data Model, Mike Brown |
| Month |