Pages

Aug 22, 2011

When XDV produces weird page source output

I just met strange behavior of the xdv with Plone where all non-ascii characters where transformed to html entities. Note: you won't notice it in the firebug but in the raw page source.

Here is simple solution which seems to be solving it:
Open your rules.xml file containing xdv rules for your theme and enclose all of them by the following xsl rule:

<?xml version="1.0" encoding="UTF-8"?>
<rules
    xmlns="http://namespaces.plone.org/xdv"
    xmlns:css="http://namespaces.plone.org/xdv+css"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output disable-output-escaping="yes"
         doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
         doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

    <xsl:text disable-output-escaping="yes">
        ... here comes all rules ...
    </xsl:text>
</rules>

 It produces the following error in the zope's event log:
...
XSLTParseError: xsltParseStylesheetTop: unknown text element

(so you should add this exception to ingored exceptions in the error log tool to not choke up your event log)

I'm not sure why when "text" is proper element defined in the xsl specification but it works ;-)
Enjoy!

0 comments:

Post a Comment