[xsl] how can I get the attribute?

Subject: [xsl] how can I get the attribute?
From: Peter Lavender <plaven@xxxxxxxxxxxxxx>
Date: Tue, 22 Oct 2002 23:29:18 +1000
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.

-- 
				Due to a lack of imagination, 
				this signature will remain 
				under construction indefinitely.

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


Current Thread