Re: selecting text

Subject: Re: selecting text
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 14 Nov 2000 11:11:36 +0000

> I need help with the following xml.
> .....
> <add-attr attrname = "manager">
>   <add-value>
>      <value assoc-ref = "75845kjl6jh46kj6456">cn=Joe
> Bloggs,cn=users,dc=domain,dc=com</value>
> </add-value>
> </add-attr>
> .......
> How do I assign the "cn=Joe Bloggs...." to a variable. I think I have got
> the variable thing right but I keep getting the "assoc-ref" stuff as well.

If the current node is the parent of the add-attr element, then:


gives you the 'value' element.  The string value of the value element
(i.e. its content) is what you're after.  You can use the string()
function to explicitly give you that value.  So:


gives you the string value:

  "cn=Joe Bloggs,cn=users,dc=domain,dc=com"

So to assign that to a variable, you can use:

  <xsl:variable name="assoc"
                select="string(add-attr/add-value/value)" />

Usually you don't need to explicitly do this because you implicitly
access the string value of an element when you use string functions
like substring-before().

I hope that helps,


Jeni Tennison

 XSL-List info and archive:

Current Thread