Transforming XMLSome talk about XML as a document format. Some talk about it as an underlying hierarchicalmodel for storing data. At another level, an XML document can be perceived as data travelingthrough a network of processing agents. Each network node stores or processes the data andtransmits the result to a neighbor node. In this world, an XML document is data flowing through orbetween applications on a network. However we look at it, any XML document is a collection ofelements organized in accordance to a certain schema (whether explicit, through the use of a DTDor other schema, or implicit, without a defined schema) and is also a potential hierarchicalstructure. We can also say that the XML document is a serialized version of a hierarchical structure a plain text document used for information exchange between processing agents. However,internally these processing agent do not use the serialized version (the XML document) but a moreworkable internal representation.If XML is to truly help us create flexible applications that will talk to each other across platformsand in different applications, and if we really want to re-use the data we mark up in XML andshare that data using XML as a common format, we need to be prepared for people andapplications that do not use the same structure for their data we do. In this chapter we will look atways in which we can transform the structure of our data into another XML vocabulary, or just re-order our own data.In this chapter, we will concentrate on the transformation aspect of processing XML. There are manyreasons why we need to transform XML, so we will start this chapter with a look at why and when wemight want to transform XML into other forms. The majority of the chapter will use XSLtransformations, although we will have a discussion at the end of the chapter about other methods fortransformations.