Turn On Compiled Transform - Eonic/ProteanCMS GitHub Wiki
The compiled transform process takes all XSLT files, including referenced or included files, and compiles them into a DLL for improved performance. This method significantly enhances the efficiency of XSLT transformations but requires careful handling to avoid HTML structural issues.
There are a few key nuances when working with compiled transforms, particularly regarding how they handle self-closing HTML tags.
HTML like this:
<div></div>
can be compiled into this:
<div/>
This can break the structure of your HTML. To prevent this, ensure that your XSLT compensates for empty tags by inserting a space. You can resolve this by using one of the following methods:
- Non-Breaking Space
<div> </div>
- Explicit Space
<div><xsl:text> </xsl:text></div>
Both of these will compile as:
<div> </div>
and will prevent issues with malformed HTML.
Before deploying any XSLT changes, ensure thorough local testing. This is especially important for changes made in the /ewcommon
or /ptn
directories. Test these in compiled mode before going live.
-
View Source Code:
Look for occurrences of/>
in your HTML output. -
Safe Tags:
Tags like<img/>
and<br/>
are fine as self-closing tags. However, other self-closing tags may indicate a problem and need fixing.
To recompile XSLTs, follow these steps:
- In
protean.web.config
, locate thecompiledTransform
setting and set it to off. - Touch the
web.config
file to restart the app. - Navigate to the
/xsltc
folder and delete all its contents. - Go back to
protean.web.config
and set thecompiledTransform
setting to on. - Touch the
web.config
file again to restart the app. - Optionally, run a rebundle for good measure.
When testing locally, you can force a recompile by appending /?recompile=true
to your URL. However, be aware that this will revert back to the original XSLT when the app pool is reset, so avoid using this method on live environments.