cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: Poor performance of document() in XSL [Was: Re: simpel cocoon question]
Date Thu, 07 Nov 2002 16:19:15 GMT
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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message