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

problem selecting node sets

Subject: problem selecting node sets
From: Paul Madsen <paul.madsen@xxxxxxxxxxxx>
Date: Thu, 09 Nov 2000 15:55:26 -0500
paul madsen
I have XML like 

<agenda>
    <activity type="flight" time="09">
    <activity type="meeting" time="11">
    <activity type="hotel" time="15"/>
    <activity type="flight" time="18"/>
</agenda>

and I would like to treat the <activity> elements that have a value of
'hotel' for the type attribute differently that the others. I want to
grab the value of the 'time' attribute on the next <activity> with
either 'meeting' or 'flight' for the value of the 'type' attribute, but
skip any <activity> elements that have a value of 'hotel' for the type
attribute. For instance, in the above, the second <activity> should
ignore the third and grab the value from the fourth instead (because the
third is of type 'hotel')

The following variable grabs the 'start' attribute  regardless of the
'type' attribute.

<xsl:variable name="nexttime"
select="following-sibling::activity[1]/@time"/>

I have experimented with the following.

<xsl:variable name="nexttype"
select="following-sibling::activity[1]@type"/>
<xsl:variable name="nexttime"
select="following-sibling::activity[position(1) = 1 and $nexttype !=
'hotel']/@time"/>

but it doesn't seem to work.

I believe that an appropriately defined <xsl:key> is the answer but I'm
having trouble with the specifics.

thanks for any guidance

-- 
Paul Madsen


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.