Re: [xsl] Variables

Subject: Re: [xsl] Variables
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 12 Jul 2004 18:12:51 +0100
  can i have some equivalent to

      <xsl:for-each
  select="/Formatos/Forms/Form/Grids/Grid/Zooms/Zoom[@Coluna!='xxx']">
      	<xsl:variable name="pages">
          <xsl:value-of select="concat(FormZoom,':')" />
      	</xsl:variable>
      	<xsl:variable name="params">
            <xsl:value-of select="concat(ParametroZoom,':')" />
	</xsl:variable>
      </xsl:for-each>


You can have _exactly_ that as that is legal syntax. The scope of a
variable though is the parent element so those variables will go out of
scope at the  </xsl:for-each> so unless you use them inside the loop
they are not very useful.

Perhaps you wanted something that is _not_ equivalent to this?
In which case, you'd need to say what it is you are trying to do
it's not possible to guess.

Going back to your original code

      <xsl:variable name="pages">
          <xsl:for-each
select="/Formatos/Forms/Form/Grids/Grid/Zooms/Zoom[@Coluna!='xxx']">
            <xsl:value-of select="concat(FormZoom,':')" />
          </xsl:for-each>
      </xsl:variable>

this makes a result tree fragment, you may well find it a lot more
useful to do


      <xsl:variable name="pages">
select="/Formatos/Forms/Form/Grids/Grid/Zooms/Zoom[@Coluna!='xxx']"/>

which gives you a variable that you can iterate over, eg if you just
want that : separated list back you could do

 <xsl:for-each select="$pages">
            <xsl:value-of select="concat(FormZoom,':')" />
  </xsl:for-each>


David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread
  • [xsl] Variables
    • xptm - Mon, 12 Jul 2004 17:57:42 +0100
      • David Carlisle - Mon, 12 Jul 2004 18:12:51 +0100 <=