[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: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Wed, 20 Sep 2006 07:04:05 -0700
xpath self
What can only be added to this very precise answer is that the function

current()

is defined by XSLT and is not an XPath function -- referencing the
current() function in a non-XSLT context will most probably produce an
error message to the effect that current() is not a recognizable
function name.

This is important to us XSLT people, because sometimes we forget this
fact and try to use XSLT gunctions in a non-XSLT environment. Other
XSLT-defined functions in this group are:

document(), generate-id(), key(), ..., etc.


Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk -------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play



On 9/20/06, David Carlisle <davidc@xxxxxxxxx> wrote:

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


the Xpath self selects the set of child elements with name self. So in XSLT 1 <xsl:value-of select="self"/> produces the string value of the first such element, and discards the rest in xslt2 it will produce the string value of each child element with name self, separated by space characters.


the xpath node() selects all child nodes of the current node (including, text comments etc)

so in So in XSLT 1
<xsl:value-of select="node()"/>
produces the string value of the first such node, and discards the
rest
in xslt2 it will produce the string value of each child node, separated
by  space characters.


the Xpath current() selects the current node, so in XSL1 and XSLT2 <xsl:value-of select="current()"/> selects the string value of the current node.

perhaps you meant self::* rather than self, self::* selects the current
node if it is an element and nothing otherwise, so it is the same as
current() if the current node is an element.

David





--


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.