|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: testing for text in one of many elements
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








