Conforming to Strict XHTML compliance with velocity?


I’m currently working on a Rhythmyx 6.5.2 implementation.

Just wondering what the best practise is for conforming to W3C compliance for strict XHTM with velocity templates? Where the solution does not impact what a user can do in Active Assembly?

As a basic example, I have this line in a template:

where the “displayfield” value will resolve to “News & Events

When the page is rendered, the source code looks like this:

<h1>News & Events</h1>

Note that the ampersand is NOT escaped which fails W3C compliance testing for strict XHTML. I could escape the field manually but I am assuming this will affect what a user will then be able to do in Active Assembly?

If anyone has any suggestions / examples or recommendations of best practise to do this, it would be greatly appreciated.

Cheers Diane

Hmm, interesting especially given the opposite problem in this thread. I thought it was correctly converting ampersands to the XML entity reference. But that was because I was highlighting a passage containing the ampersand and using the View Selection Source right-click option in Firefox, which takes the corresponding nodes in its DOM interpretation and converts them back into valid XHTML. Viewing the actual source output by Rhythmyx, I can confirm we have this problem too.

I guess if it is absolutely vital that it be fully XHTML compliant, a short term hack would be to search and replace using techniques in this thread (although the one suggesting passing it through an XSL stylesheet presumably won’t work, because this is an tenant of XML well-formedness, not just XHTML validity.)

We actual had this problem due to the “unique” implementation of navigation where unescaped special characters were causing problems. We ended up creating an “escaped” version of the macros to deal with out problem. Incidentally this also allowed us to address the infamous & in the title bar for IE.