xsl-list
[Top] [All Lists]

Re: [xsl] XSLT 2.0: When to use xsl:sequence, when to use xsl:value-of, and why?

2007-06-16 09:19:09
"M. David Peterson" wrote:

  Hi David

In XSLT 2.0, when should I use xsl:sequence, when should I use  
xsl:value-of, and why?

  The difference is quite simple: xsl:sequence returns the result of
the evaluation of an XPath expression (that is, a sequence), while
xsl:value-of creates one new fresh text node from a sequence.  The
exact rules to build the text node value from a sequence of item()* are
described there:

    http://www.w3.org/TR/xslt20/#value-of
    http://www.w3.org/TR/xslt20/#constructing-simple-content

  You can also trying the following stylesheet, then replace
xsl:value-of by xsl:sequence:

    <xsl:stylesheet
        xmlns:xsl="http://www.w3c.org/1999/XSL/Transform";
        version="2.0">

      <xsl:variable name="elem" as="element()">
        <elem a="value"/>
      </xsl:variable>

      <xsl:template match="/">
        <xsl:sequence select="$elem/@a"/>
      </xsl:template>

    </xsl:stylesheet>

  Regards,

--drkm



















      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--