Re: how do indirection in value-of or select?

Subject: Re: how do indirection in value-of or select?
From: Michael Koehrsen <koehrsen@xxxxxxxxx>
Date: Sat, 27 Feb 1999 09:02:09 -0500

> I would like to be able to say:
>     <xsl:template match="/a/blist/b">
>         <xsl:apply-templates select="name"/>
>         <xsl:apply-templates select='/a/clist/c[d=@n]'/>
>     </xsl:template>

You're implicitly assuming that the @n is going to be resolved against
the node matched by the containing template, rather than the node being
tested by the select pattern.  This strikes me as kind of an ad-hoc
extension to existing pattern semantics.  I think this example leads
back to the general problem of needing to be able to store some local
state in templates.  If we had local constants, for example, you could

    <xsl:template match="/a/blist/b">
      <xsl:apply-templates select="name"/>
      <xsl:constant name="n" value="{@n}"/>
      <xsl:apply-templates select='/a/clist/c/[d=constant(n)]'/>

This requires a change to pattern syntax, but the semantics are
straightforward and consistent.


 XSL-List info and archive:

Current Thread