Search

1_ Let's say I have a classic Textarea Field with no formatter. If I fill this:

<p>Contains & and less < than and of course greater > than</p>
        it even contains line feeds & tabs
    <br />

The output in debug view is this:

&lt;p&gt;Contains &amp; and less &lt; than and of course greater &gt; than&lt;/p&gt;
it even contains line feeds &amp; tabs
&lt;br /&gt;

Now I want to XSLT process the HTML code but don't know how (aka convert entities to special characters and return the result). Any ideas?

<xsl:copy-of select="field" /> doesn't work, of course.


2_ A similar issue appears in Frontend Localisation extension. I'm storing $key => $value pairs of translation strings and $value can contain HTML code which is added to XML output via a DS.

How to process the above textarea input value to this?

<p>Contains &amp; and less &lt; than and of course greater &gt; than</p>
        it even contains line feeds &amp; tabs
    <br />

a.k.a. convert everything but tags? I was looking at Markdown extension but I'm lost ...

For #1 try using xsl:value-of and use the disable-output-escaping attribute.

I haven't used Frontend Localisation so can't comment on #2.

For #1 try using xsl:value-of and use the disable-output-escaping attribute.

Worked. Thanks !

I haven't used Frontend Localisation so can't comment on #2.

You don't even need to (and is recommended not to, yet). I was just wondering how to achieve this result:

<p>Contains &amp; and less &lt; than and of course greater &gt; than</p>
        it even contains line feeds &amp; tabs
    <br />

And I was looking at how Markdown does it, but couldn't figure it. So was asking for some direct help.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details