[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

Subject: Re: testing for text in one of many elements
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 19 Jun 2003 16:29:13 +0100
function of uno
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.