Skip to content

Instantly share code, notes, and snippets.

@alexwilson
Last active March 10, 2016 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexwilson/51cf21f6d7d1bd9a7395 to your computer and use it in GitHub Desktop.
Save alexwilson/51cf21f6d7d1bd9a7395 to your computer and use it in GitHub Desktop.
How to use literal HTML in eZ Platform
## Path can point wherever, this currently assumes that you're whacking everything in /ezpublish/
## but really this should be in a bundle.
system:
some_siteaccess_name:
fieldtypes:
ezxml:
custom_tags: [{path: %kernel.root_dir%/Resources/views/fields/ezxml/fields.xsl}]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"
xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
exclude-result-prefixes="xhtml custom image">
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<!-- Literal HTML -->
<xsl:template match="literal">
<xsl:choose>
<xsl:when test="@class='html'">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>
<pre>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</pre>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment