[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XPATH 1.0: Selecting an element attribute starting

Subject: Re: XPATH 1.0: Selecting an element attribute starting from a self:: attribute
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Jun 2015 14:05:06 -0000
Re:  XPATH 1.0: Selecting an element attribute starting
Malecki, Piotr piotr.malecki@xxxxxxxxxxxxxxxx wrote:

<library>

<catalog>

<book id="_1" name="Book1"/>

<book id="_2" name="Book2"/>

<book id="_3" name="Book3"/>

</catalog>

<customer>

<borrowed bookId="_1"/>

<borrowed bookId="_2"/>

</customer>

</library>

In an appplication (Windows WPF / XAML), my execution context is e.g.
the element "borrowed" (e.g. <borrowed bookId="_1"/>).

I have to find the name of the book which is referenced as bookId.

So my XPATH expression is like:

"//book[@id=self::*/@bookId]/@name"

Read as: give all books whose id equals to the bookId of the current node.


The context node inside of the predicate
  [@id = self::*/@bookId]
is the "book" element so both
  @id
as well as
  self::*
are evaluated with the "book" element as the context node and
  self::*
simply selects that "book" element.

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.