cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya A. Kriveshko" <i...@kaon.com>
Subject Poor performance of document() in XSL [Was: Re: simpel cocoon question]
Date Tue, 05 Nov 2002 14:32:34 GMT
SAXESS - Hussayn Dabbous wrote:

> <snip/>
> But you also could do it directly within the xslt context:
> You can use the document() function in your XSLT-file.
> This function allows you to refer to data contained within
> another XML-file. This is completely decoupled from cocoon
> though. It's more about how to work with XSLT:
> <snip/>


In the past I have encountered a nasty performance problem with document().
For example, when you declare an xsl variable that gets its value from a 
document(),
and then use its value several times throughout the stylesheet, the URI 
of the document
gets hist as many times as there are references to that variable. I.e. 
the xsl variable
does not store the XML fragment it was given at the variable definition 
time, but
merely stores the XPath string and then resolves it every time it's 
referenced.
This may or may not be true for XPath expressions that do not contain 
document()
as well. Does anyone know for sure?

Example:

<xsl:variable name="test-me" 
select="document('cocoon:/gimme-sumthn')/sumthn/in/@there"/>

<xsl:template match="/">
  <this-is-just-a-test>
    <xsl:value-of select="$test-me"/>
    <xsl:value-of select="$test-me"/>
    <xsl:value-of select="$test-me"/>
  </this-is-just-a-test>
</xsl:template>

When using Xalan, this example will cause the Cocoon pipeline that
is responsible for "gimme-sumthn" to be hit three times. I say,
document() is good for rapid prototyping, but is a poor choice for final
deployment for performance reasons. Use aggregation instead.

+2c
--
Ilya





---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message