service. The mapping between DTDIDs and XML namespaces is defined by the following group.properties parameter:

￿namespaceTable is a reference to an XML resource that defines the mapping between DTDIDs and XSD namespaces and locations.

The algorithm for mapping a DTDID to an XSD namespace and location is as follows:

￿Lookup the DTDID in the namespaceTable. If an entry exists then use the defined namespace and location.

￿Otherwise, the DTDID cannot be mapped so throw an exception.

Modifying the XSL file

We need to modify the namespace in passengerList.xsl since the Web Service has added some lines that were not specified on the DTD file.

￿Add namespaces specified in the Web Service returned format shown Example 9-8.

Example 9-8 Namespaces

xmlns:xsd1="http://tempuri.org/Travel/TravelGroup/passengerList.dadx/XSD"

xmlns:pl="http://www.airline.com/passengerList.dtd"

The returned root element from the Web Service is different, since it uses the name of the operation. Change XSL file as shown in Example 9-9.

Example 9-9 Changing root element

<!--======================================================================-->

<!--

The Root Element

-->

<!--

The "Root Element" section specifies which template will be

-->

<!-- invoked first thus determining the root element of the result tree. --> <!--======================================================================-->

<xsl:template match="xsd1:retrieve_passengerList_rdbResult"> <xsl:call-template name="html"/>

</xsl:template>

Since we introduce a variable named pl in the namespace, we have to use it in every occurrence of an element like Flight, Customer, and so on. See completed xsl file in Example 9-10.

Example 9-10 passengerList.xsl

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

Chapter 9. Developing XML Web services 209

Page 225
Image 225
IBM Version 5 manual Modifying the XSL file, Example 9-8 Namespaces, Example 9-9 Changing root element