Pages

Thursday, January 12, 2012

Make the case of your element and attribute names consistent with XSLT

A common use of the XSLT translate() function is to change the case of text strings within a document; however, you may run into situations where you need to change the actual element and attribute name cases, not simply text strings within them.

For instance, you may receive well-formed XML submissions from multiple sources which use the same element/attribute names, but one may use uppercase, another upper-lower, and another all lowercase. Or you may be trying to integrate data from disparate XML data sets and need to change the case for consistency across tag names.

You can use the XSLT translate() function to do this for you. The XSLT stylesheet below is a standalone process that converts one XML document into another, changing the case of all elements and attributes from uppercase to lowercase.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.