xsl-list
[Top] [All Lists]

RE: Global variable

2005-02-21 03:58:40
Hi,

I have a stylesheet with several templates in it. In every template I 
need the same variable, so I think the best is to make it 
global!

XSLT spec uses the term top-level variable.

But I 
have one problem with it: I do not know the value of the 
variable at the 
beginning of the stylesheet. I get it in my first template. 
So in this 
template I have a local variable and I need to make it global.

Is this possible?

No.

If you have

<xsl:template match="foo">
  <xsl:variable name="bar" select="@baz" />
  ...
</xsl:template>

you can rewrite it to

<xsl:variable name="bar" select="foo/@baz" />
<xsl:template match="foo">
  ...
</xsl:template>

but without seeing your stylesheet it's hard to advice more.


Cheers,

Jarno - Eufex: If It Skips... Tough Shit!

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>