Programming with XSL and XSLT

Although Internet Explorer 5 cannot identify the namespace in an XSLT document, versions 2.6 and higher of the XML parser can use XSLT documents to transform XML documents. We will use the same BizTalk document we used earlier in this chapter, with some minor changes that will fix errors in the document, to perform the transformation using XSLT documents. Even though we did not receive any error messages when we used the BizTalk document, two errors do exist in the code. The following two elements are not defined in the schema as being children of the POlines element:


If you try to work with the BizTalk document using the XML DOM, the load method of the IXMLDOMDocument interface will fail. It's important to note this, as we have come this far with no hint that there was an error in the document. This stresses the importance of validating your documents. To correct the error, delete the above two elements from the XML document and rename the document NorthwindPOXSLT.xml. You can also delete the references to these two elements in your XSL and XSLT document. Let's now look at a code sample, which you could use in your production systems, that shows how to code with the XML DOM.


For XML that does not contain elements that define the presentation of the XML documents, you can use CSS, XSL, or XSLT documents to transform the document. XSL provides a powerful tool to transform XML documents in virtually any way that is necessary. Currently XSL focuses on the transformation of XML into XHTML. It is likely that XSL will provide more powerful transformations in the future.

CSS, XSL, and XSLT allow us to transform XML into user services components that present XML data in a manner that would provide users with the information they require. Up to this point, the browser-based user services components we have built were not dynamic-that is, they did not allow the user to interact with the information being presented in the interface. If we want to allow users to input information, select the information they want to view, and interact with the interface, we need to add code to our user services components that will perform these functions and update the user interface. We'll discuss how to create the dynamic user services components in Chapter 13.