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 November 4th, 2003, 10:59 AM
Authorized User
 
Join Date: Nov 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing Attributes of Siblings

Is it possible to directly access an attribute of a sibling node?
This is what I am trying to accomplish:

<xsl:if test="following-sibling::node()[1][@level] > @level">
  Do something.
</xsl:if>

The problem is that following-sibling::node()[1][@level] is not returning any value. Am I going about this the wrong way?

Thanks in advance for any help!

-Aaron

 
Old November 4th, 2003, 12:17 PM
Authorized User
 
Join Date: Oct 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"following-sibling::node()[1][@level]" will return the first node on the following-sibling axis provided it has an attribute "level". To return the contents of "@level", use:

following-sibling::node()[1]/@level

...sam

 
Old November 4th, 2003, 01:39 PM
Authorized User
 
Join Date: Nov 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You rock, that worked perfectly.






Similar Threads
Thread Thread Starter Forum Replies Last Post
first element in array nesting siblings rjonk XSLT 1 May 18th, 2008 03:53 PM
Problem accessing the following siblings. Tre XSLT 6 June 5th, 2007 11:13 AM
Comparing siblings Chamkaur XSLT 1 June 17th, 2006 09:56 PM
Accessing Attributes P137 jadusty BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 3 February 27th, 2006 07:13 AM
Turning Siblings into Children wolfie78uk XSLT 3 December 22nd, 2005 08:33 AM





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