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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>



Reply via email to