cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantin Piroumian" <>
Subject Re: disable-output-escaping
Date Mon, 30 Oct 2000 14:05:51 GMT

>I´m trying to write a stylesheet, that conditionally
>surrounds a block of output with an "<a href>".
>My first idea was to write something like
><xsl:if test="condition">
>  <xsl:text disable-output-escaping="true"><a href="url"></xsl:text>
>generate some output
><xsl:if test="condition">
>  <xsl:text disable-output-escaping="true"></a></xsl:text>

This is not a very good XSL usage. I know that in some cases there is need
for creating the first tag and end-tag separately, but in most cases you can
do it using standart XSLT rules. And, I think, you cannot do it without

E.g., you can do it this way:

<xsl:template name="link">
    <xsl:param name="content"/>
    <xsl:param name="url"/>
    <a href="{$url}"><xsl:value-of select="$content"/></a>

and call it anywhere:

<xsl:if test="condition">
    <xsl:call-template name="link">
        <xsl:with-param name="url">your_url</xsl:with-param>
        <xsl:with-param name="content">generate some content


>but that doesn´t work, the FAQ tought me why.
>Any idea how to solve this problem WITHOUT a bunch of duplicate code?

View raw message