[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XPath Problem - selecting the previos node
Hi, > 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. Cheers, Jarno - In Strict Confidence: Another Night
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|