Re: [xsl] xsl:sequence

Subject: Re: [xsl] xsl:sequence
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 9 Aug 2006 13:05:52 +0100
> My point is that if xsl:sequence can mimic xsl:value-of behavior in this way 
> whats the point of using xsl:value-of ever?

xsl:value-of returns the string value of an element, and that isn't
obtainable from xsl:sequence (without doing a lot of work that the
system has already done) The string-value of an element is designed to
produce the "right" text in cases where XML is being used as originally
designed as a markup language marking up a text flow.

See the example I showed earlier

<p><i>This</i> is <b>bold</b> text</p>

the string value of that paragraph is "This is bold text" and that is
what <xsl:value-of select="p"/> returns.

<xsl:sequence select="p/text()"/> returns the sequence of child text
nodes, that is the sequence of two text nodes " is " and " text"  this
collection of words that happened not to be marked up isn't usually very

The functions of xsl:sequence and xsl:value-of are almost completely
different and usually it's clear which you should use.
xsl:copy-of and xsl:sequence of are much closer, as the difference is
that copy-of makes a copy, but in most situations where you need to
copy, for example copying nodes from the input tree to the result, there
is an implied copy operation anyway so the distinction between
xsl:copy-of and xsl:sequence is hidden.


Current Thread