Re: [xsl] Nesting XPath predicates

Subject: Re: [xsl] Nesting XPath predicates
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Thu, 24 Apr 2008 18:47:19 +0100
On 24/04/2008, Liam Quin <liam@xxxxxx> wrote:
> On Thu, Apr 24, 2008 at 09:17:05AM +0100, Andrew Welch wrote:
>  > On 24/04/2008, Liam Quin <liam@xxxxxx> wrote:
>  > > Easier might be
>  > >    <xsl:template match="dataset">
>  > >      <xsl:variable name="sn" select="serviceName" />
>  > >      <xsl:value-of select="//service/[@name = $sn]/@base" />
>  > >    </xsl:template>
>  >
>  > It is easier to use a variable when you're learning, but this is what
>  > the current() function is for:
>
>
> Good point.
>
>  > //service[@name = current()/serviceName]
>
>  That will work in the given example, but stops working if you put
>  that line inside a for-each...  or more precisely works differently :-)
>  so it's fragile, and not a technique that people can build on well.

Really...?  How does it work differently?


cheers
-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread