[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: Stuart Brown <sbrown@xxxxxxxxxxx>
Date: Thu, 19 Jun 2003 16:18:13 +0100
xsl test function
Hi Mattison,

Try

<xsl:template match="User">
 <xsl:if test="Function = 'Function Uno'">
  <a href="function_one.asp">Func One</a>
 </xsl:if
</xsl:template>

This works because the XPath "Function" returns a node-set of ALL the
Function children of User. If ANY of them then meet the condition, you have
a true result.

Regards,

Stuart

-----Original Message-----
From: Mattison [mailto:peacock@xxxxxxxxx]
Sent: 19 June 2003 16:09
To: XSL-List
Subject:  testing for text in one of many elements


Greetings

Here is the problem in a nutshell.  I've got xml that looks like this:

  <User>
    <Name>Joe User</Name>
    <Function>Function Uno</Function>
    <Function>Function Cinco</Function>
    <Function>Function Dos</Function>
  </User>

Using this I need to put xsl:if statements on a series of links (which
aren't in a neat list), so the links only display if the user has that
function.  I have some ability to control the xml, though not the function
names which do have spaces in them.

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>

Any suggestion are welcome, including, "really you shouldn't set your xml
up that way, try this instead".  Though the constraint of the function
names do have spaces, so <Function_Uno>Yes</Function_Uno> isn't an option.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+      Mattison Narramore                  peacock@xxxxxxxxx      +
+-----------------------------------------------------------------+
+ The most likely way for the world to be destroyed, most experts +
+ agree, is by accident. That's where we come in; we're computer  +
+ professionals. We cause accidents.                              +
+                   -Nathaniel Borenstein                         +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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

 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.