Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2008, 12:48 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default Difference between name(*) and name()

Hi,

Could anybody explain the difference between name(*) and name() functions in xsl. Thanks in advance for your response.

 
Old March 11th, 2008, 02:48 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

* means 'all children' and hence name(*) will return the name of the first child element.

name() returns the name of the current node.

/- Sam Judson : Wrox Technical Editor -/
 
Old March 11th, 2008, 03:53 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

> * means 'all children' and hence name(*) will return the name of the first child element.

That's true in 1.0. In 2.0, name(*) will give an error if there is more than one child. If you want the name of the first child, you should say so: name(*[1]).

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 11th, 2008, 06:40 AM
Authorized User
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Sam & Michael,

Thanks a lot to both of you for the response.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference ashu .NET Framework 1.x 1 March 27th, 2007 09:46 AM
Difference between / vs ./ vs ../ arulkumar ASP.NET 2.0 Basics 1 February 21st, 2007 12:19 PM
difference Magen Classic ASP Basics 2 January 29th, 2007 04:48 PM
what's the difference? jdkxxx Oracle 3 October 8th, 2005 12:33 PM
The difference mhergenrader J2EE 1 July 15th, 2005 07:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.