XPointer and Xpath Indexing and Linking

Chapter 6 • XML and Data Representation 245 An example of an extended link is: xlink:extended xmlns:xlink=http:www.w3.orgXMLXLink0.9 role=resources title=Web Resources showdefault=replace actuatedefault=user xlink:locator href=http:www.xml.com role=resource title=XML.com xlink:locator href=http:www.mcp.com role=resource title=Macmillan xlink:locator href=http:www.netscape.com role=resource title=Netscape Communications xlink:locator href=http:www.abcnews.com role=resource title=ABC News Link Behavior XLink provides behavior policies that allow link authors to signal certain intentions as to the timing and effects of link traversal. These include: • Show: The show attribute is used to express a policy as to the context in which a resource that is traversed to should be displayed or processed. It may take one of three values: embed, replace, new. • Actuate: The actuate attribute is used to express a policy as to when traversal of a link should occur. It may take one of two values: auto, user. • Behavior: The behavior attribute is used to provide detailed behavioral instructions.

6.4 Document Transformation and XSL

As explained above, XML is not a fixed tag set like HTML so the tags do not carry a fixed, application-specific meaning. A generic XML processor has no idea what is “meant” by the XML. Because of this, a number of other standards to process the XML files are developed. Extensible Stylesheet Language XSL is one such standard. XML markup usually does not include formatting information. The information in an XML document may not be in the form in which it is desired to be presented. There must be something in addition to the XML document that provides information on how to present or otherwise process the XML. XSL transforms and translates XML data from one XML format into another. It is designed to help browsers and other applications display XML. Stated simply, a style sheet contains instructions that tell a processor Ivan Marsic • Rutgers University 246 such as a Web browser, print composition engine, or document reader how to translate the logical structure of a source document into a presentational structure. The XMLXSL relationship is reminiscent of the Model-View-Controller design pattern [Gamma et al ., 1995], which separates the core data from the way it gets visualized. Likewise, XSL enables us to separate the view from the actual data represented in XML. This has following advantages: Reuse of data: When the data is separate you do not need to transform the actual data to represent it in some other form. We can just use a different view of the data. Multiple output formats: When view is separate from the data we can have multiple output formats for the same data e.g. the same XML file can be viewed using XSL as VRML, HTML, XML of some other form Reader’s preferences: The view of the same XML file can be customized with the preferences of the user. Standardized styles: Within one application domain there can be certain standard styles which are common throughout the developer community. Freedom from content authors: A person not so good at presentation can just write the data and have a good presenter to decide on how to present the data. Different ways of displaying an XML files are shown in Figure 6-7. XSL can act as a translator, because XSL can translate XML documents that comply with two different XML schemas. XSL is an unfortunate name, since you may think it deals only with stylesheets. That is not true, it is much more general and as I said, XSL can translate any XML document to any other XML document. XSL Example The following example shows an original XML document transformed to an HTML document. XML XSL HTML text XML Transformation Engine XSL Processor General form of a template rule: xsl:template match=pattern ... action ... xsl:template Figure 6-7. How XSL transformation works.