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

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

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

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.