Web service example 6: Transforming attributes to dhild elements |
When exporting USoft application data, for an RPC-oriented method it is recommended to use child elements instead of attributes for complex type parameters. The reason why is that some client applications may not support or properly recognize attributes for those RPC-calls. So, the output must have the following basic structure:
By default, the XML export method results in an XML document with attributes, like:
To achieve a document structure containing child elements, an XSL transformation is needed to transform the default output of the xml export method. This XSL transformation is:
You can store this XSL transformation in a file, for example: att2childelts.xsl, and then execute the following statement to get an output containing child elements: INVOKE USXSL.apply WITH SELECT ( INVOKE xml.export WITH SELECT * FROM schedtour WHERE destination = 'AUSTRALIA') XmlDocument , 'att2childelts.xsl' ) |