XSL2

XSL Component Overview

  • XSL actually is a collection of three separate W3C recommendations:
    • XSL Transformations (XSLT), which defines the semantics of the various elements and attributes of the XSL namespace;
    • XML Path Language (XPath), which defines the syntax and semantics of many of the attribute values used in XSL elements for accessing portions of the inputXMLdocument;
    • XSL Formatting Objects (XSL-FO), a separate XML vocabulary for defining style properties of an XML document.

 


 

// HW.xsl

<?xml version=”1.0″ encoding=”UTF-8″?>

<xsl:transform version=”1.0″

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

xmlns=”http://www.w3.org/1999/xhtml”>

<xsl:template match=”/”>

<html>

<head>

<title>HelloWorld.xsl (transformed)</title>

</head>

<body>

<p><xsl:value-of select=“child::message” /></p>

</body>

</html>

</xsl:template>

</xsl:transform>

FIGURE 7.12 An example XSL document HW.xsl.

 

  • The XSL document of Figure 7.12 illustrates elements of both XSLT and XPath. Specifically, the values of the match and select attributes are XPath expressions, while the transform, template, and value-of elements along with their attributes are defined by the XSLT recommendation.
  • In our example, the template data was primarily XHTML markup, and the result document was an XHTML file