[thelist] RE: XSL / XPath

Tim Kuhn (temp) Tim.Kuhn at gettyimages.com
Tue Nov 4 11:12:53 CST 2003


I think that this is what you want, this will select the inner-text if that is what you want: <body>

<xsl:template match="headline">
	<xsl:apply-templates select="/furtherdetails/runner[1]" /> </xsl:template>

<xsl:template match="headline">
	<xsl:apply-templates select="/furtherdetails/runner[2]" /> </xsl:template>

</body>

If you an attribute then:
<xsl:apply-templates select="/furtherdetails/runner[1]@id" /> 
That will give you the first runner nodes id. Careful it is all case sensitive.

A good link for XPath is http://www.zvon.org/xxl/XPathTutorial/General/examples.html 

I hope that helps!

-----Original Message-----

Here's a chunk of XML:

<headline>
         <furtherdetails>
                 <event id="248914" eventtypeid="94" betlive="0" 
bettingtype="Outright" numrunners="20">2003 World Cup - Outright</event>
                 <runner id="847157" handicap="0" currentprice="1.25" 
fractionprice="5/4 ">New Zealand</runner>
                 <runner id="847158" handicap="0" currentprice="1.5" 
fractionprice="3/2 ">England</runner>
                 <runner id="847159" handicap="0" currentprice="5" 
fractionprice="5/1 ">Australia</runner>
                 <runner id="847160" handicap="0" currentprice="12" 
fractionprice="12/1 ">France</runner>
         </furtherdetails>
</headline>

I'm trying to work out the XSL/XPath stuff to say "Take the first two 
runner nodes and do THIS with them", where THIS is dropping some of the 
values into a HTML table.

Anyone able to explain it? The XPath things have me baffled.


------------------------------




=======================================================
This email and its contents are confidential. If you
are not the intended recipient, please do not disclose
or use the information within this email or its
attachments. If you have received this email in error,
please delete it immediately. Thank you.
=======================================================


More information about the thelist mailing list