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 May 13th, 2009, 02:29 PM
Registered User
 
Join Date: May 2009
Posts: 8
Thanks: 6
Thanked 0 Times in 0 Posts
Default how to Determine wether its first node

hi,

is there a way to find out wether the node is first node and dont have any preceding-sibling

ex:

<Row>
<Data>
<value>5</value>
</Data>
<Data>
<value>3</value>
</Data>
</Row>

i want a way to find out that <Data> with value 5 doesnt have any preciding siblings or its first node.
Thanks
 
Old May 13th, 2009, 05:20 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you're processing all the Data nodes using for-each or apply-templates, you can test position()=1. Otherwise, you can test not(preceding-sibling::*)
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
vreddy (May 13th, 2009)
 
Old May 13th, 2009, 06:13 PM
Registered User
 
Join Date: May 2009
Posts: 8
Thanks: 6
Thanked 0 Times in 0 Posts
Default

thanks for the reply , i did it using second way





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying data as a Parent Node with Left Node and Right Node Manoj Bisht Visual Basic 2008 Professionals 0 April 2nd, 2009 02:34 AM
The reference node is not a child of this node.XSL XMLUser XSLT 2 February 25th, 2008 05:22 AM
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 05:30 AM
Determine If A Tag or Node Exists coolpeep Classic ASP XML 2 July 20th, 2006 06:16 PM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM





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