This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: selecting text
- To: Michael Jones / QDC Pta <MichaelJ at PQAfrica dot co dot za>
- Subject: Re: selecting text
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Tue, 14 Nov 2000 11:11:36 +0000
- CC: "'XSL-List at mulberrytech dot com'" <XSL-List at mulberrytech dot com>
- Organization: Jeni Tennison Consulting Ltd
- References: <1417D0B36A9CD411B46D00508BB1AAF77999E7@exchmds02.pqafrica.co.za>
- Reply-To: xsl-list at mulberrytech dot com
Michael,
> 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:
add-attr/add-value/value
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:
string(add-attr/add-value/value)
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
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list