On Wednesday, Nov 6, 2002, at 21:26 Europe/London, Stephen Ng wrote:

I say,
document() is good for rapid prototyping, but is a poor choice for
final deployment for performance reasons. Use aggregation instead.
The Cocoon developers recommend to use aggregation or
xinclude because of SoC (XSLT is for transforming, not for
aggregating content).
Sure, but I have a big lookup table in an xml file--it seems much more
natural to reference the lookup table from xslt using document rather
than to jam it into my content stream....
You may find, if you re-encode your lookup table as XSLT variables, that you can 'include' your data as XSLT into your stylesheet.

eg.

constants.xslt:

<xsl:variable name="colours">
<colour id="white">#fff</colour>
<colour id="black">#000</colour>
<colour id="grey">#888</colour>
</xsl:variable>

main.xslt:

<xsl:include src="constants.xslt"/>

......

<xsl:template match="foo">
<xsl:variable name="colour" select="@colour"/>
<bar>
<xsl:attribute name="colour">
<xsl:value-of select="$colours[@id=$colour]"/>
<!-- or is it: <xsl:value-of select="$colours/colours[@id=$colour]"/> -->
</xsl:attribute>
</bar>
</xsl:template>

Hope this helps

regards Jeremy


---------------------------------------------------------------------
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