Hello Jeremy,

normally this won't work. You create a Result Tree Fragment in $colours and have to convert it to a node set using node-set() extension function. This is not possible when using XSLTC.

Or you do something like document('')/*/xsl:variable[@name='colours']/colour[@id=$colour], but this is not possible while including the constants.xslt.

Regards,

Joerg

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