[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: First Occurance Problem

Subject: Re: First Occurance Problem
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 25 Mar 2003 13:35:21 +0000
xslt select first
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.