[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Using vars

Subject: Using vars
From: xptm <xptm@xxxxxxx>
Date: Mon, 26 Jul 2004 19:09:24 +0100
xsl vars
In terms of performance, what will be the best way to do this? Having:

<Formatos>
<Forms>
<Form Nome="ProcessoTipoGrupoListaDoc">
<Grids>
<Grid Nome="ProcessoTipoGrupoLista_Grid" SourceObject="ProcessoTipoGrupoLista_Grid">
<Zooms>
<Zoom Coluna="ProcessoTipoGrupo">
<FormZoom>ProcessoTipoGrupoDoc</FormZoom>
<ModoZoom>AZ</ModoZoom>
<ParametroZoom>ProcessoTipoGrupo</ParametroZoom>
</Zoom>
</Zooms>
</Grid>
</Grids>
(*/ n Grids/ *)
</Form>
</Forms>
</Formatos>


should i use one variable like

<xsl:template name="StandardEvents">
<Events>
<xsl:variable name="pages"
select="/Formatos/Forms/Form/Grids/Grid/Zooms/Zoom[@Coluna!='xxx']/*[name()='FormZoom' or name()='ParametroZoom']" />
<Event method="tablemouse" type="MouseHandler">
<xsl:attribute name="target">GridPanel</xsl:attribute>
<xsl:attribute name="next">
<xsl:for-each select="$pages">
<xsl:if test="name()='FormZoom'">
<xsl:value-of select="." />
<xsl:text>:</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
<xsl:attribute name="params">
<xsl:for-each select="$pages">
<xsl:if test="name()='ParametroZoom'">
<xsl:value-of select="." />
<xsl:text>:</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
</Event>
</Events>
</xsl:template>



or two vars, like


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


    <Event method="tablemouse" type="MouseHandler">
           <xsl:attribute name="target">GridPanel</xsl:attribute>
           <xsl:attribute name="next">
             <xsl:value-of select="$pages" />
           </xsl:attribute>
           <xsl:attribute name="params">
             <xsl:value-of select="$params" />
           </xsl:attribute>
          </xsl:attribute>
   </Event>
 </Events>
</xsl:template>


If i understand correctly, the first only traverses the tree once and the second two times, so if the tree is very big the first option is better?


Thxs.

Current Thread
  • Using vars
    • xptm - Mon, 26 Jul 2004 19:09:24 +0100 <=
      • <Possible follow-ups>
      • Passin, Tom - Mon, 26 Jul 2004 14:55:44 -0400
      • xptm - Tue, 27 Jul 2004 14:00:55 +0100

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.