Subject: Re: [xsl] Best practices - using vars From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 23 Aug 2004 17:45:16 +0100 |
> What is the cost of using vars? I'm doing this, for instance: higher if you use them as you have with content rather than a select attribute. <xsl:variable name="xtabnode"> <xsl:value-of select="document(concat('.\DicionarioXml\',$MasterTable,'.xml'))/Estrutura/Tabelas/Tabela[Nome=$MasterTable]"/> </xsl:variable> produces a result tree fragment with a root node and child a text node with string value the string you want. When this result tree fragment is used, it has to be coerced back to a string. <xsl:variable name="xtabnode"> select="document(concat('.\DicionarioXml\',$MasterTable,'.xml'))/Estrutura/Tabelas/Tabela[Nome=$MasterTable]"/> is less to type and makes the variable have (a pointer to) the Tabela node in the specified document. or perhaps <xsl:variable name="xtabnode"> select="string(document(concat('.\DicionarioXml\',$MasterTable,'.xml'))/Estrutura/Tabelas/Tabela[Nome=$MasterTable])"/> in which case the variable holds the string value itself. similarly all your other variable declarations should have select= 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Best practices - using vars, xptm | Thread | Re: [xsl] Best practices - using va, xptm |
[xsl] Best practices - using vars, xptm | Date | Re: [xsl] Best practices - using va, xptm |
Month |