Written by James McDonald

January 9, 2009

At work we have an ERP system that can receive information in a proprietary XML format via directory drop or Web service call.

Our customers place orders with us using disparate systems and methods. Fortunately most of them output some sort of XML.

How to convert one form of XML to another form of XML?

The answer is XML Stylesheet Language Translations or XSLT.

Basically you write a template in XSL and then apply it to an XML file and out pops a new XML/HTML file to your specifications.

I found that xsltproc (available in Cygwin and Linux) is a great test-bed tool.

When you are struggling to learn the XSL Language you don’t need to add further complexity by trying to make it all work using VBS or JScript.

With the xsltproc tool you can write your XSL code and then try it out via the command line:

xsltproc yourstylesheet.xsl yourinput.xml

xsltproc by default sends your output to stdout which is great for debugging immediately…

XSLT allows you to massage the data and make decision as it parses the XML file so you can output the correct information.

I learnt enough to do a working XML to XML translation in about 2 days.

Once you have a working XSL file that converts the XML to the new format. The challenge is to script it.

Because we have Windows XP boxes I chose VBS and MSXML to apply the XSL to the XML and then do a webservice call to the remote ERP system. In Microsoft’s attempt to provide some security for VBS scripts you find that trying to run a VBS from a network drive causes a security warning …. Grumble.

The things we learn.

Reference: http://www.w3schools.com/xsl/xsl_w3celementref.asp

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...