cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Corin Moss" <>
Subject RE: document() in xsl:variable -> low performance
Date Tue, 04 May 2004 01:37:48 GMT

Hi There,

I've not been following this thread as closely as I might, so someone might have already mentioned

If you use a string() function on your document value as below:

<xsl:variable name="lang"><xsl:value-of select="string(document('cocoon:/getxml')/context/lang)"/></xsl:variable>

Then you will forevermore be accessing only the value, not the entire document :)

Some might say it's a little hacky, but it is a simple fix which works.



-----Original Message-----
From: Nils Köster []
Sent: Monday, 3 May 2004 9:20 a.m.
Subject: document() in xsl:variable -> low performance


In a stylesheet, I have this in the first line, outside of any template:

<xsl:variable name="lang"><xsl:value-of select="document('cocoon:/getxml')/context/lang"/></xsl:variable>

In the templates of this xsl I use the variable $lang about 40 times. The procession of this
stylesheet is very slow.

When I reduce the use of the variable $lang to one or none, it's very fast. When I use "en"
(without quotes) instead of <xsl:value-of select="document('cocoon:/getxml')/context/lang"/>
it's very fast, as well.

--> Does that mean, that everytime I use $lang cocoon executes
document('cocoon:/getxml') ??
--> How can I avoid that?


To unsubscribe, e-mail:
For additional commands, e-mail:

CAUTION: This e-mail and any attachment(s) contains information
that is intended to be read only by the named recipient(s). It
may contain information that is confidential, proprietary or the
subject of legal privilege. This information is not to be used by
any other person and/or organisation. If you are not the intended
recipient, please advise us immediately and delete this e-mail
from your system. Do not use any information contained in it.

For more information on the Television New Zealand Group, visit
us online at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message