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

RE: XPath Problem - selecting the previos node

Subject: RE: XPath Problem - selecting the previos node
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Mon, 25 Oct 2004 12:27:57 +0300
xpath previous sibling

> I need to store the value of the first previous sibling,
> which doesn't start with "-" in a variable.
> Heres my XML:
> <?xml version="1.0" encoding="UTF-8"?>
> <norm xmlns="http://www.lexisnexis.at/schema/norm" id="abgb">
> 	<stichworte>
> 		<stichwort_alt>Abgerissenes Land 412(1)</stichwort_alt>
> 		<stichwort_alt>Abhandlung der Erbschaft
> 797</stichwort_alt>
> 		<stichwort_alt>Anerkennung der Vaterschaft
> 154</stichwort_alt>
> 		<stichwort_alt>-, Rechtswirksamerkldrung
> 164</stichwort_alt>
> 		<stichwort_alt>-, Widerspruch 163d, 163e</stichwort_alt>
> ...
> I need to replace leading "-" with the first word of the
> previous sibling not beginging with "-".
> So my desired output should look like
> 	...
> 	<stichwort_alt>Anerkennung der Vaterschaft 154</stichwort_alt>
> 	<stichwort_alt> Anerkennung, Rechtswirksamerkldrung
> 164</stichwort_alt>
> 	<stichwort_alt> Anerkennung, Widerspruch 163d,
> 163e</stichwort_alt>

You want

  preceding-sibling::ln:stichwort_alt[not(starts-with(., '-'))][1]

i.e. the first match in reverse document order.


Jarno - In Strict Confidence: Another Night

Current Thread


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.
First Name
Last Name
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.