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

Re: Getting the first preceding node

Subject: Re: Getting the first preceding node
From: lac <e107lac@xxxxxxxxx>
Date: Fri, 17 Oct 2008 15:37:44 +0200
Re:  Getting the first preceding node
Thank you!

Lac

On Fri, Oct 17, 2008 at 15:08, Ronan Klyne <ronan.klyne@xxxxxxxxxxx> wrote:
> lac wrote:
>> Hi List!
>>
>> I need a little help in a XPath expression.
>>
>> This is a test xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <element type="cat">CAT 1</element>
>> <element>PROD 1</element>
>> <element>PROD 2</element>
>> <element>PROD 3</element>
>> <element>PROD 4</element>
>>
>> <element type="cat">CAT 2</element>
>> <element>PROD 5</element>
>> <element>PROD 6</element>
>> <element>PROD 7</element>
>> <element>PROD 8</element>
>>
>> How can I get the first preceding element which has an attribute by
>> name type, and value is cat?
>>
>> For example:
>>
>> In PROD 1 is the result CAT 1
>> In PROD 5 is the result CAT 2
>>
>>
>> Sorry for my bad language, and thanks for the help.
>>
>> Lac
>
> I think you want this XPath:
>
> preceding-sibling::element[@type='cat'][1]
>
>
>        Ronan
>
> --
> Ronan Klyne
> Business Collaborator Developer
> Tel: +44 01189 028518
> ronan.klyne@xxxxxxxxxxx
> www.groupbc.com

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.