|
Subject: Re: [xsl] First Occurance Problem From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 25 Mar 2003 13:35:21 +0000 |
David,
> me
> <xsl:copy-of select="(agg2/tag1[string(.)])[1]"/>
>
> Jeni
> <tagx>
> <xsl:value-of select="(agg2/tag1[string(.)])[1]" />
> </tagx>
>
> Note that the ( )[1] is requrired in my version (with copy-of) but
> isn't actually needed in Jeni's (with value-of) as that always just
> takes the value of the first node in document order.
>
> Jeni's either just making it explicit for pedagogical reasons, or
> preparing us all for XSLT2 where the first node semantics will be
> replaced by returning a sequence of all values if I recall
> correctly.
I was making it explicit for pedagogical reasons. XSLT 2.0's
<xsl:value-of> will still act as it does in XSLT 1.0; it's only if you
add a separator attribute that it creates a text node in which all the
string values of the items in the sequence are included, separated by
the string specified in the sequence attribute, e.g.:
<xsl:value-of select="(1, 2, 3)" /> => "1"
<xsl:value-of select="(1, 2, 3)"
separator=" " /> => "1 2 3"
<xsl:value-of select="(1, 2, 3)"
separator"" /> => "123"
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] First Occurance Problem, David Carlisle | Thread | RE: [xsl] First Occurance Problem, Michael Kay |
| Re: [xsl] Copy XML into an attribut, Oleg Tkachenko | Date | [xsl] transforming to breaks, Koes, Derrick |
| Month |