Search

I have a field in a section, that contains HTML, which I want to output after some transformations.

I old versions of Symphony, I was able to use a textbox field to do this. In the data source I could select the raw HTML, which would be included as something like this:

<content-en><p>... <a href="{$root}/en/project/" title="...">...</a> ...</p></content-en>

So, in my XSLT I just needed to call

<xsl:apply-templates select="content-en/*" mode="html"/>

to pass the HTML to the templates that would make some transformations to the HTML (e.g. replace the {$root} with an URL).

Apparently this does not work anymore. Now the raw HTML is inside a CDATA, that is, the XML that I have to transform is something like this:

<content-en><![CDATA[<p>... <a href="{$root}/en/project/" title="...">...</a> ...</p>]]></content-en>

My question is, how can pass the HTML contained in the CDATA to templates? Is there any type field that allows me to get raw HTML directly in the data source?

Maybe if you would apply a text formatter to that textarea, you could return in your datasource a formatted field's content, that is the markup directly.

Using a text formatter is my suggestion as well.

It has been thoroughly discussed—and it's a good decision—to wrap raw input in CDATA sections. Formatters are the tool of choice to generate HTML from textarea contents.

Thanks for your help.

I ended up defining a basic formatter that just outputs the input and solved the problem.

Cool!

Thanks @michael-e for the confirmation.

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