|
The translate algorithm described will not work with all XML - specifically if the element or attribute names contain '.' or '-', or if the XML uses namespaces.
If the element attribute names contain '.' or '-' then these get translated into characters that are invalid as element/attribute names, e.g. try this XML...
<root>
<elem-name.is attrib-name.is="some value">some text</elem-name.is>
</root>
Tweaking the translate values would resolve this but...
If the XML has namespaces it will also barf - because the namespace prefixes are translated but those prefixes are then not declared, e.g. try this XML...
<?xml version="1.0"?>
<ns1:root xmlns:ns1="urn:some-uri1">
<ns1:elem-name.is ns1:attrib-name.is="some value">some text</ns1:elem-name.is>
</ns1:root>
This is also resolveable - by adding the @namespace attribute to the <xsl:element> and <xsl:attribute>, e.g.
<xsl:element name="{$rot13_elem}" namespace="{namespace-uri()}">
and
<xsl:attribute name="{$rot13_attr}" namespace="{namespace-uri()}">
Cheers
Marrow
|