Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > BOOK: Beginning XML 3rd Edition
|
BOOK: Beginning XML 3rd Edition
This is the forum to discuss the Wrox book Beginning XML, 3rd Edition by David Hunter, Andrew Watt, Jeff Rafter, Jon Duckett, Danny Ayers, Nicholas Chase, Joe Fawcett, Tom Gaven, Bill Patterson; ISBN: 9780764570773
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning XML 3rd Edition 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 September 25th, 2008, 05:50 PM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default select another attribute value

If I have a XML like so
<Book Title="Othello" Author="William Shakespeare" />

How do I select the value of another attribute if I know the value of the 1st?
i.e. /Book[@Title='Othello'] but I want the value of Author

any ideas?

Thanks

 
Old September 26th, 2008, 02:28 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Non book-specific queries are better posted to the general XML forum. In your case the XPath is:
Code:
/Book[@Title='Othello']/@Author
It's the same as :
Code:
/Book/@Author
but with the:
Code:
[@Title='Othello']
predicate.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace an attribute with another attribute georgemeng XSLT 8 June 10th, 2008 11:04 AM
Access to attribute values from class of attribute jacob C# 1 October 28th, 2005 01:11 PM
<xsl:for-each> with a variable select="attribute" BeneathClouds XSLT 1 August 1st, 2005 03:36 AM
Select Options ~ "multiple" attribute phungleon SQL Server 2000 2 July 21st, 2004 10:54 AM
xsl:sort- select attribute, syntax question Flashlight XSLT 3 August 14th, 2003 12:27 AM





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