Changing an Element to an Attribute

Now it's time to generate an invoice, and the billing module of our order management system follows the same conventions as the order entry module. Our customer uses the invoice created by the same standards body that developed the schema used for the purchase order. So, we need to change unit of measure from an Element to an Attribute. We use the same source and result documents as in the previous example, but we reverse their roles. Again, the transformation is pretty simple.

Stylesheet (ElementToAttribute.xsl)
 <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template ...

Get Using XML with Legacy Business Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.