You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ben Anderson <be...@gmail.com> on 2006/01/06 15:33:19 UTC

disable-output-escaping htmlserializer

Hi,
I believe I have one of the exceptional cases where I need to use the
xsl:test element with disable-output-escaping="yes".  Here's my
dilemma:

      <xsl:for-each ...
        <xsl:variable name="pos" select="position()"/>
        <xsl:variable name="cellContent">
          <!-- some snazzy html -->
        </xsl:variable>
        <xsl:choose>
          <xsl:when test="($pos mod 2) = 1">
            <xsl:text disable-output-escaping="yes"><![CDATA[<tr>]]></xsl:text>
            <xsl:copy-of select="$cellContent"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:copy-of select="$cellContent"/>
            <xsl:text disable-output-escaping="yes"><![CDATA[</tr>]]></xsl:text>
          </xsl:otherwise>
        </xsl:choose>

The only reason I tried using xsl:text is because without it, my xsl
document is not valid xml.  Is there a way around this?  If not is
there any particular reason I'm getting this as my output:

<?javax.xml.transform.disable-output-escaping >&lt;tr
class="Highlight"&gt;<?javax.xml.transform.enable-output-escaping >
as my output?

I'm using saxon... and I found a note by Michael Kay that says
something like "your serializer probably doesn't support the
disable-output-escaping interface".

Any ideas?  I'm guessing this is a common use case and maybe I'm
completely missing a much easier way to do it?

Thanks,
Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: disable-output-escaping htmlserializer

Posted by Ben Anderson <be...@gmail.com>.
yes, that should work.  Good thinking, Joose.  Just curious, though, -
won't this be a considerable performance hit?

On 1/6/06, Joose Vettenranta <jo...@iki.fi> wrote:
> why don't you do like this:
>
> <xsl:for-each>
> <xsl:variable name="pos" select="position()" />
> <xsl:if test="$pos mod 2 = 1">
> <tr>
> <td>
> <xsl:copy-of select="." />
> </td>
> <td>
> <xsl:copy-of select="../list[position() = ($pos + 1)]" />
> </td>
> </tr>
> </xsl:if>
> </xsl:for-each>
>
> - Joose
>
> Ben Anderson kirjoitti 6.1.2006 kello 16:33:
>
> > Hi,
> > I believe I have one of the exceptional cases where I need to use the
> > xsl:test element with disable-output-escaping="yes".  Here's my
> > dilemma:
> >
> >       <xsl:for-each ...
> >         <xsl:variable name="pos" select="position()"/>
> >         <xsl:variable name="cellContent">
> >           <!-- some snazzy html -->
> >         </xsl:variable>
> >         <xsl:choose>
> >           <xsl:when test="($pos mod 2) = 1">
> >             <xsl:text disable-output-escaping="yes"><![CDATA[<tr>]]
> > ></xsl:text>
> >             <xsl:copy-of select="$cellContent"/>
> >           </xsl:when>
> >           <xsl:otherwise>
> >             <xsl:copy-of select="$cellContent"/>
> >             <xsl:text disable-output-escaping="yes"><![CDATA[</tr>]]
> > ></xsl:text>
> >           </xsl:otherwise>
> >         </xsl:choose>
> >
> > The only reason I tried using xsl:text is because without it, my xsl
> > document is not valid xml.  Is there a way around this?  If not is
> > there any particular reason I'm getting this as my output:
> >
> > <?javax.xml.transform.disable-output-escaping >&lt;tr
> > class="Highlight"&gt;<?javax.xml.transform.enable-output-escaping >
> > as my output?
> >
> > I'm using saxon... and I found a note by Michael Kay that says
> > something like "your serializer probably doesn't support the
> > disable-output-escaping interface".
> >
> > Any ideas?  I'm guessing this is a common use case and maybe I'm
> > completely missing a much easier way to do it?
> >
> > Thanks,
> > Ben
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
>
> --
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: disable-output-escaping htmlserializer

Posted by Joose Vettenranta <jo...@iki.fi>.
why don't you do like this:

<xsl:for-each>
<xsl:variable name="pos" select="position()" />
<xsl:if test="$pos mod 2 = 1">
<tr>
<td>
<xsl:copy-of select="." />
</td>
<td>
<xsl:copy-of select="../list[position() = ($pos + 1)]" />
</td>
</tr>
</xsl:if>
</xsl:for-each>

- Joose

Ben Anderson kirjoitti 6.1.2006 kello 16:33:

> Hi,
> I believe I have one of the exceptional cases where I need to use the
> xsl:test element with disable-output-escaping="yes".  Here's my
> dilemma:
>
>       <xsl:for-each ...
>         <xsl:variable name="pos" select="position()"/>
>         <xsl:variable name="cellContent">
>           <!-- some snazzy html -->
>         </xsl:variable>
>         <xsl:choose>
>           <xsl:when test="($pos mod 2) = 1">
>             <xsl:text disable-output-escaping="yes"><![CDATA[<tr>]] 
> ></xsl:text>
>             <xsl:copy-of select="$cellContent"/>
>           </xsl:when>
>           <xsl:otherwise>
>             <xsl:copy-of select="$cellContent"/>
>             <xsl:text disable-output-escaping="yes"><![CDATA[</tr>]] 
> ></xsl:text>
>           </xsl:otherwise>
>         </xsl:choose>
>
> The only reason I tried using xsl:text is because without it, my xsl
> document is not valid xml.  Is there a way around this?  If not is
> there any particular reason I'm getting this as my output:
>
> <?javax.xml.transform.disable-output-escaping >&lt;tr
> class="Highlight"&gt;<?javax.xml.transform.enable-output-escaping >
> as my output?
>
> I'm using saxon... and I found a note by Michael Kay that says
> something like "your serializer probably doesn't support the
> disable-output-escaping interface".
>
> Any ideas?  I'm guessing this is a common use case and maybe I'm
> completely missing a much easier way to do it?
>
> Thanks,
> Ben
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org