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

Re: how can I get the attribute?

Subject: Re: how can I get the attribute?
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 22 Oct 2002 15:56:02 +0200
route.gif
<xsl:value-of select="../../yacht/@yachtid"/>

or with complete axes for maybe better understanding:

<xsl:value-of select="parent::route/parent::cruise/child::yacht/attribute::yachtid"/>

another possibility:

<xsl:value-of select="parent::route/preceding-sibling::yacht/attribute::yachtid"/>

or back to the short way:

<xsl:value-of select="../preceding-sibling::yacht/@yachtid"/>

Regards,

Joerg

Peter Lavender wrote:
Hi Everyone,

I'm tring to get the xpath right to grab the yachtid attribute from a
template.. here is the structure of the document:

<cruise_doc>
<cruise cruiseid='5152' status='available'>
<!-- Comment for Cruise 5152 --> <price>761</price>
<description>Any text describing this cruise
5152</description>
<yacht yachtid='154'/>
<route>
<date>2002-07-17</date>
<harbor>ZAKYNTHOS</harbor>
<date>2002-07-20</date>
<harbor>AGIA GALINI</harbor>
<date>2002-07-25</date>
<harbor>SANTORINI</harbor>
<date>2002-07-30</date>
<harbor>ATHEN</harbor>
<image file='route.gif'/>
</route>
<skipper>
<!-- Comment for Processing Instruction pinst1 -->
<?pinst1 now='stop'?>
<name>WATTS,JOSEPH</name>
<address>
<zip>DE1 2KL</zip>
<city>DERBY</city>
<street>3 SADLER GATE</street>
</address>
<image file='skipper.gif'/>
<description>Any text describing this skipper
WATTS</description>
</skipper>
</cruise>
</cruise_doc>


And here is my template:

<xsl:template name="passLocation">
<xsl:param name="passes" select="AZOREN"/>
<h2>Cruise(s) that pass <xsl:value-of select="$passes"/></h2>
<xsl:for-each select="/cruise_doc/cruise/route/harbor">
<xsl:if test=". = $passes">
<br/><b>Yacht ID:</b> <xsl:value-of
select="../../self::yacht[@yachtid]"/>
<br/><b>Cruise:</b> <xsl:value-of
select="../../@cruiseid"/>
<br/><b>Starting Point:</b><xsl:text> </xsl:text>
<xsl:value-of select="../harbor[1]"/>
<br/><b>Ending Point:</b><xsl:text> </xsl:text>
<xsl:value-of select="../harbor[last()]"/><br/>
</xsl:if>
</xsl:for-each>
</xsl:template>



Each bit EXCEPT where I try to get the attribute works...


I'm at a loss... the combinations I have tried are numerous, and
probably amazingly bad.. :)


br/><b>Yacht ID:</b> <xsl:value-of select="../../self::yacht[@yachtid]"/>




THanks...


Regards,


Pete.



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.