Subject: Re: [xsl] how can I get the attribute? From: Joerg Heinicke <joerg.heinicke@xxxxxx> Date: Tue, 22 Oct 2002 15:56:02 +0200 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] how can I get the attribute?, Peter Lavender | Thread | [xsl] ?group? but keep order of ele, Naraschewski, E. |
RE: [xsl] exsl:node-set behaviour w, Michael Kay | Date | [xsl] ?group? but keep order of ele, Naraschewski, E. |
Month |