[thelist] XSL / XPath

Drew Shiel ashiel at sportsinteraction.com
Tue Nov 4 10:43:20 CST 2003


At 11:00 04/11/2003 -0500, aardvark wrote:

   I found it just before this came in. What I needed was:

   <xsl:apply-templates select="./headline/furtherdetails/runner[position() 
&lt;= 2]"></xsl:apply-templates>

   and

   <xsl:template match="runner[position() &lt;= 2]">
   STUFF HERE
   </xsl:template>

   And it works. :)

   Cheers,
   Drew.


>drew... i don't have time to write up the code that you'd need, but
>take a look at the count() or position() functions...
>
>while looping (for-each), do a count on the nodes where the
>count()/position() is less than or equal to 2...
>
>that help at all?
>
> > From: Drew Shiel <ashiel at sportsinteraction.com>
>[...]
> > <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.
>
>--
>my latest book project:
>   Web Graphics for Non-Designers
>   http://www.amazon.com/exec/obidos/ASIN/1590591712/evoltorg02-20
>   ISBN: 1590591712
>--
>* * Please support the community that supports you.  * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !



More information about the thelist mailing list