Re: [xslt] Variable scope in for-each

On Thu, Jun 17, 2004 at 04:32:20PM +0200, Claus Augusti wrote:
> Hi,
> while trying to port an application from Linux to Windows (using libxml 
> 10019 and libxslt 20423 on both machines), I got a "redefining name" 
> error on Windows. We're using something like the following quite often:
> <xsl:for-each select="./someNode">
>  <xsl:variable name="id" select="./elem[ id]"/>
>  ...
> </xsl:for-each>
> After looking into the specs I'm not quite sure how to interpret the 
> section on variables in conjunction with for-each. It's clear that a 
> variable binding is visible for the following siblings and its 
> descendants. But how to interprete that inside for-each elements? Is the 
> for-each loop re-entered for every node letting the binding become 
> invisible or not? Thus, is the above construct correct XSLT or not?

  it seems correct to me, the version is quite old though, try with a newer
one, and please provide a full example if you need any further debugging.


Daniel Veillard      | Red Hat Desktop team
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]