xsl-list
[Top] [All Lists]

RE: [xsl] Difference between current(), node() and self ??

2006-09-20 07:05:54
Until now, I thought that
<xsl:value-of select="self"/>, <xsl:value-of 
select="node()"/> and <xsl:value-of select="current()"/> 
would print out the same values, but found out that this is not true.

They are completely different.

select="current()" (or select=".", or select="self::node()") selects the
context node.

select="node()" selects the children of the context node.

select="self" selects a child element called self.


It seems that current() prints out all the values including 
its child...

current() doesn't "print out" anything. It selects a node. If anything is
printed, that's done by whoever it is that selects the node. For example,
<xsl:value-of select="current()"/> creates a text node whose content is the
string value of the current node (if it's an element, this will be the
concatenation of all its descendant text nodes); and if you choose to print
out this text node on paper, that's what you will see.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
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>
--~--

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