XSLT: Elements and Attributes |
||
The most common XSLT element is the xsl:template element that defines a template in an XSLT style sheet. In this style sheet, the xsl:template element is typically associated with a match attribute. A match attribute associates a template with an element in an XML document. A match attribute takes an XPath expression as its value. Another commonly used element is the xsl:value-of element. It extracts the contents of an element defined in an XML document. The xsl:value-of element is associated with the select attribute that takes an XPath expression as a value to locate an element in the XML document. The code snippet on the right displays the XSLT style sheet that uses the xsl:template and xsl:value-of elements to transform the following XML document into an HTML document: <Book> After creating an XSLT style sheet, you need to use an XSLT processor. An XSLT processor is a program that transforms the XML document according to the rules specified in the XSLT style sheet. An example of a commonly used XSLT processor is Xalan-Java, which implements the javax.xml.transform interface in Java API for XML Processing (JAXP). The graphic displays the output of the preceding transformation. |
|
|
Click the Next button to continue. |