One problem some face when posting to the XML forum is the need to maintain the privacy of proprietary data contained in an XML document. So, the poster will often try to paraphrase the XML document that is at issue and in the process mis-state the structure in a way that leads to miscommunication.
The following XSLT does a reasonable job of obscuring both the XML element and attribute names, and the data, in an XML document.
This works well on Saxon, and reasonably well on MSXML.
You can change the [highlight #8AE234]string defined for myTranslate[/highlight] as you see fit. The obfuscate template shifts the upper case letters, lower case letters and numbers each as a group for each level of recursion. Therefore you might want to group your upper case, lower case and numbers together as in the example. Especially for the numbers, keeping the numbers together allows the obfuscator to produce number strings where there were numbers in the original.
Namespaces are not obfuscated, so this will be something you must do yourself if necessary. (There is no way to match namespace nodes in a template in XSLT/XPath version 1, so obfuscating namespace values would have introduced more complexity for very little benefit.)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.