Turn On Compiled Transform - Eonic/ProteanCMS GitHub Wiki

Compiled Transform Overview

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.


Important Considerations

There are a few key nuances when working with compiled transforms, particularly regarding how they handle self-closing HTML tags.

Example

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:

Solutions

  1. Non-Breaking Space
<div>&#160;</div>  
  1. Explicit Space
<div><xsl:text> </xsl:text></div>  

Both of these will compile as:

<div> </div>  

and will prevent issues with malformed HTML.


Testing Best Practices

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.

What to Check

  1. View Source Code:
    Look for occurrences of /> in your HTML output.

  2. 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.


Recompiling Steps

To recompile XSLTs, follow these steps:

  1. In protean.web.config, locate the compiledTransform setting and set it to off.
  2. Touch the web.config file to restart the app.
  3. Navigate to the /xsltc folder and delete all its contents.
  4. Go back to protean.web.config and set the compiledTransform setting to on.
  5. Touch the web.config file again to restart the app.
  6. Optionally, run a rebundle for good measure.

Recompiling Locally

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.



⚠️ **GitHub.com Fallback** ⚠️