Translating XML documents to EDIFACT
Once an XML document is created that contains the proper content to fill an EDIFACT structure, the adapter will do the syntactical translating for you. But how do you get the XML data to look right?
Using the same steps as in Converting EDIFACT to XML, we're going to load an EDIFACT document into the editor, change it, and save it back out — and we'll watch the change occur. This will demonstrate an XML document turning back into EDIFACT.
Then we'll see how we can do this automatically as part of an XSLT transformation.
Here are the steps for this demonstration:
Perform the following steps:
Let's change the recipient from DATADIRECT to SAXONICA.
Comparing the two files shows that you just changed an EDIFACT document without an EDIFACT editor, or even seeing the EDIFACT file itself!
What this does is the same thing we just did, but mechanically. It finds thesegment and replaces whatever content text was there with the string . It also filters out any comments (but we could pass them along by replacing the line
<xsl:when test="local-name(.) = '#comment'"/>with the lines
<xsl:when test="local-name(.) = '#comment'">but we don't really need them.)
The adapters can be used in other contexts as well. They may be built right in to your own applications, using either the data conversion API or as part of your file handling or XSLT/XQuery processing through the deployment adapters.
PURCHASE STYLUS STUDIO ONLINE TODAY!!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Try Stylus EDI Tools
Simplify working with Electronic Data Interchange (EDI) with Stylus Studio®'s award-winning EDI Tools — Download a free trial of our today!
What's New for X15?
New XQuery & Web Services Tools, Support for MySQL, PostgreSQL, HL7 EDI, Microsoft .NET Code Generation and much more!
Stylus Studio® EDIFACT Zone
Simplify your next legacy data integration project with the help of the EDIFACT Zone, the world's largest, free online reference covering all EDIFACT and UN/CEFACT versions.