Subject: RE: Difference between current(), node() and self ??
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 20 Sep 2006 15:05:36 +0100
|
> 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/
|