xsl-list
[Top] [All Lists]

RE: testing for text in one of many elements

2003-06-19 09:20:15
[Mattison]
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>

A couple of questions.  

1. Do you know all the function names ("Funcion Uno") beforehand or do
you have to get them from the source xml file?

2. What is the rule to go from Function names (possibly with spaces) to
the .asp file name?  Do yiou have to compute it, or are they already
pre-ordained?  If the latter, you could do a simple lookup table - there
are several ways to set that up, all of them easy.

Cheers,

Tom P


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



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