On 24/04/2008, Liam Quin <liam(_at_)w3(_dot_)org> wrote:
Easier might be
<xsl:template match="dataset">
<xsl:variable name="sn" select="serviceName" />
<xsl:value-of select="//service/[(_at_)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:
//service[(_at_)name = current()/serviceName]
(I've also dropped the odd / after service)
The current() function changes the context node to what is was outside
of the XPath, so the <dataset> element in this case.
Ultimately though, you should use a key here:
<xsl:key name="service-by-name" match="service" use="@name"/>
with
key('service-by-name', serviceName)
cheers
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--