Access Key Menu:

Skip to top of page.

XSLT can be a pain in the arse when including trying to include tags that are both XSLT related and (x)HTML related.  The Comments and CDATA tags are a couple of those beast.

In my toils of implementing an XSLT that has JavaScript Code embeded within the XSLT, I ran into a problem of wanting my output to validate with the XHTML document that I was rendering in to.  Well, the task is not an easy one, but I finally got a solution, while it is not pretty, it worked.

Be careful copying the code from below, as using the "view plain" option transforms the output.  Use the "copy to clipboard" option or view the page source to copy this code.

As you can see, basically, I escaped the CData tags, but wrapped them in the XSL:Text tags to disable the escaping, returning the code back into the actual characters desired.  While this is a simple idea, I struggled with getting the correct syntax, and felt I would share it with you.

Skip to top of page. Skip to top of page.