Re: [xsl] XPATH 1.0: Selecting an element attribute starting from a self:: attribute

Subject: Re: [xsl] XPATH 1.0: Selecting an element attribute starting from a self:: attribute
From: "Frederik Fouvry frederik.fouvry@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Jun 2015 13:54:32 -0000
You're not retrieving @bookId from the correct element:

//book[@id = ancestor::library/customer/borrowed/@bookId]/@name


Frederik Fouvry



On 17 June 2015 at 15:48, Malecki, Piotr piotr.malecki@xxxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

>  Hello,
>
>
>
> The question corresponds basically to XPATH 1.0 (not to XSL).
>
>
>
> I have an XML like this (snippet only):
>
>
>
> <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 Query  is executed for the "borrowed" node (execution context).
>
>
>
> Unfortunately the expression doesn't return the result expected (rather an
> empty set).
>
>
>
> What is wrong in my understanding here?
>
>
>
> Thank you
>
> regards
>
> Piotr
>
>
>
>
>
> Mit freundlichen GrC<Cen / Kind regards
>
>
>
> *Dipl.-Ing. Piotr Malecki*
>
>
>
> Systemingenieur / Systems Engineer
>
> Waffen und FC<hrung Systemintegration
>
> Weapon, Command & Control System Integration
> Operating Unit Surface Vessels
>
>
>
> ThyssenKrupp Marine Systems GmbH
> Hermann-Blohm-Strasse 3 - 20457 Hamburg- Germany
> P:O.Box 10 07 20 - 20005 Hamburg - Germany
>
> Phone: +49 (0) 431 / 700 2446
> Fax: +49 (0) 431 / 700 1600 2446
>
> *Mailto:piotr.malecki@xxxxxxxxxxxxxxxx <piotr.malecki@xxxxxxxxxxxxxxxx>*
>
>
>
> ThyssenKrupp Marine Systems GmbH
> Chairman of the Supervisory Board: Dr. Hans Christoph Atzpodien
> Executive Board: Andreas Burmester (Chairman), Dieter Rottsieper, Dr.
> Walter Klausmann, Torsten KC6nker
> Commercial Register: District Court of Kiel HRB 6960 KI
> Registered Office: Kiel
>
> Wie Sie wissen, kC6nnen C<ber das Internet versandte E-Mails unter fremdem
> Namen erstellt oder der Inhalt verC$ndert werden.
> Aus diesem Grund sind unsere als E-Mail verschickten Nachrichten
> grundsC$tzlich keine rechtsverbindlichen ErklC$rungen.
> Der Inhalt dieser E-Mail samt Anlagen ist vertraulich und u. U. rechtlich
> geschC<tzt.
>
> As you are aware, messages sent by e-mail can be manipulated by third
> parties. For this reason our e-mail messages are generally not legally
> binding.
> This electronic message (including any attachments) contains confidential
> information and may be privileged or otherwise protected from disclosure
>    XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <-list/2700505> (by
> email <>)
>



--
Frederik Fouvry
Senior Linguistic Engineer

T: +49 (0)30 288 8483 548
F: +49 (0)30 288 8483 39
Frederik.Fouvry@xxxxxxxxxxxx <frederik.fouvry@xxxxxxxxxxxx>

Acrolinx GmbH
Friedrichstr. 100 | 10117 Berlin | Germany
www.acrolinx.com

Executive Board: Kumar Vora, Ulrich Callmeier
Registered office: Berlin / Commercial register: Local court Berlin HRB
84183

Current Thread