cocoon-users mailing list archives

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

>Hello,
>
>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>
></xsl:if>
>
>...
>generate some output
>...
>
><xsl:if test="condition">
>  <xsl:text disable-output-escaping="true"></a></xsl:text>
></xsl:if>

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
disable-output-escaping.

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>
</xsl:template>

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
here</xsl:with-param>
   </xsl:call-template>
  </xsl:if>

Regards,
  Kot.

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



Mime
View raw message