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

Re: XSLT 2.0: When to use xsl:sequence, when to use x

Subject: Re: XSLT 2.0: When to use xsl:sequence, when to use xsl:value-of, and why?
From: "M. David Peterson" <m.david@xxxxxxxxxxxxx>
Date: Sat, 16 Jun 2007 15:45:49 -0600
Re:  XSLT 2.0: When to use xsl:sequence
On Sat, 16 Jun 2007 14:55:24 -0600, Florent Georges <darkman_spam@xxxxxxxx> wrote:

  Well, in this particular example, that doesn't change a
lot.

Yeah, and I'm guessing that in cases where there is a difference it will be 100% related to performance, which in most cases is going to be processor dependent. So I guess the question of "all things being equal, which would be the prefered method?" would be answered by: "Well that depends..." :D


But there are cases where the generated content will
not be the same, depending on the content of the sequence
itself.  Read through the B'5.7 "Sequence Constructors", this
is very useful, interesting and well, required to write
XSLT

Oh, I've read the spec more than I would like to admit in a public setting. ;-) That said, looks like its time for another reading session to update this cranium of mine with a deeper understanding of this particular topic.


 For an example:
   <xsl:transform
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="2.0">
     <xsl:output indent="yes" omit-xml-declaration="yes"/>
     <xsl:variable name="v" as="element()+">
        <elem>1</elem>
      </xsl:variable>
     <xsl:variable name="s" select="
          $v/text(), 'a', $v/text()"/>
     <xsl:template match="/">
        <sequence>
          <xsl:sequence select="$s"/>
        </sequence>
        <value-of>
          <xsl:value-of select="$s"/>
        </value-of>
      </xsl:template>
   </xsl:transform>
should produce:
   <sequence>1a1</sequence>
    <value-of>1 a 1</value-of>

Oh, interesting. Okay, so yeah, with this in mind I can now see what you are referring to. Thanks for taking the time to provide the sample!


 I say "should" because I've really evaluated the example
with Saxon and got instead:
   <sequence>1a1</sequence>
    <value-of>1 a1</value-of>
 So I reread B'5.7.2 and I can't understand how this result
is build.  Seems like a bug to me, while it would be very
surprising to still find this kind of bug in Saxon.
Michael?

Hey, even better! I don't mean that in a "Ha ha, Saxon or the spec have a bug!" and instead from the standpoint that finding bugs in either of these items is going to be a rare event, so if they exist, the sooner they are found, the better.


Thanks for your help, Florent!

--
/M:D

M. David Peterson
http://mdavid.name | http://www.oreillynet.com/pub/au/2354 | http://dev.aol.com/blog/3155


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.