Eksempel: a_weather
schema-fil(a_weather.xsd)
<?xml version="1.0" encoding="iso-8859-1"?>
<wt:schema xmlns:wt="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<wt:element name="weatherdata">
<wt:complexType>
<wt:sequence>
<wt:element name="weatherAttributes" minOccurs="0" maxOccurs="unbounded">
<wt:complexType>
<wt:attribute name="city" type="wt:string" use="required"/>
<wt:attribute name="time" type="wt:dateTime" use="required"/>
<wt:attribute name="temp" type="wt:float" use="optional" default="0.0"/>
<wt:attribute name="wspd" type="wt:float" use="optional" default="0.0"/>
<wt:attribute name="rain" type="wt:integer" use="optional" default="0"/>
</wt:complexType>
</wt:element>
</wt:sequence>
</wt:complexType>
</wt:element>
</wt:schema>
xml-fil(a_weather.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Laget av Elin Andreassen, hiof 2003 -->
<?xml-stylesheet type="text/xsl" href="a_weather.xsl"?>
<weatherdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="a_weather.xsd">
<weatherAttributes city="Halden" time="2003-11-22T10:01:36" temp="-3.4" wspd="0.0" rain="1" />
<weatherAttributes city="Sarpsborg" time="2001-09-01T17:04:15" temp="7.3" wspd="3.0" rain="0" />
<weatherAttributes city="Halden" time="2002-01-15T10:01:36" temp="-9.4" wspd="10.0" rain="5" />
</weatherdata>
style-fil(a_weather.xsl)
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Weather-data</title>
</head>
<body>
<xsl:for-each select="weatherdata/weatherAttributes">
<p>
<table border="0" cellpadding="3" cellspacing="0">
<xsl:for-each select="@*">
<xsl:variable name="navn" select="name()"/>
<xsl:variable name="verdi" select="."/>
<xsl:choose>
<xsl:when test="$navn='city'">
<tr>
<th colspan="2">
<h1>Weather in <xsl:value-of select="$verdi"/></h1>
</th>
</tr>
</xsl:when>
<xsl:otherwise>
<tr>
<th align="left"><xsl:value-of select="$navn"/></th>
<td><xsl:value-of select="$verdi"/></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>
</p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Se resultat(krever IE5 eller nyere)