xsl-list
[Top] [All Lists]

Re: First Occurance Problem

2003-03-25 06:35:21
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



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