The following example performs an sxml encoding on an input string. The string.sxmlencode and sxml.encode vipers produce exactly the same results.
This is a snippet from the default render template in our test site. The results for the current item as rendered on the Functional test channel (FUN) are embedded in the page, followed by the expected result.
The actual render template includes JavaScript that compares the two results and changes the background colour of the divs to reflect a passed or failed test.