XSLT - XML Style Language Transformation
Printer Friendly Page
- Allows formatting and styling of XML documents.
- Allows transforming XML documents to other forms, such as HTML or Text.
Basic XSLT Structure:
<?xml version ="1.0" encoding="utf-8" standalone="yes" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
OR
<xsl:output method="xml"/>
OR
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
These two lines appear at the top of each
XSLT sheet:
The second line is the
VERSION and
NAMESPACE.
<?xml version ="1.0" encoding="utf-8" standalone="yes" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
The following tells
XSLT how to format the output.
Only
one these is used in a stylesheet.
The available types are:
- <xsl:output method="html"/>
- <xsl:output method="xml"/>
- <xsl:output method="text"/>
- <xsl:output method="xhtml"/>
This is always at the
end of the
XSLT sheet.
The
transformation instructions are before this line.
</xsl:stylesheet>
The
XML document needs the following line to reference the
XSLT sheet.
<?xml-stylesheet href="xyz.xsl" type="text/xsl"?>