Eksempel: vaer
schema-fil(vaer.xsd)
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Skjema for værdata Elin 2003 -->
<wt:schema xmlns:wt="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<wt:complexType name="weatherType" mixed="true">
<wt:sequence minOccurs="0" maxOccurs="unbounded">
<wt:element ref="city"/>
<wt:element ref="rain"/>
<wt:element ref="temp"/>
<wt:element ref="time"/>
<wt:element ref="wspd"/>
</wt:sequence>
</wt:complexType>
<wt:element name="city" type="wt:string"/>
<wt:element name="time" type="wt:dateTime"/>
<wt:element name="temp" type="wt:float"/>
<wt:element name="wspd" type="wt:float"/>
<wt:element name="rain" type="wt:integer"/>
<wt:element name="weatherdata">
<wt:complexType>
<wt:sequence>
<wt:element name="weather" type="weatherType" maxOccurs="unbounded"/>
</wt:sequence>
</wt:complexType>
</wt:element>
</wt:schema>
xml-fil(vaer.xml)
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Laget av Elin Andreassen, hiof 2003 -->
<?xml-stylesheet type="text/xsl" href="vaer.xsl"?>
<weatherdata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vaer.xsd">
<weather>
<city>Halden</city>
<time>2003-11-22T10:01:36</time>
<temp>-3.4</temp>
<wspd>0.0</wspd>
<rain>1</rain>
</weather>
<weather>
<city>Sarpsborg</city>
<time>2001-09-01T17:04:15</time>
<temp>7.3</temp>
<wspd>3.0</wspd>
<rain>0</rain>
</weather>
<weather>
<city>Halden</city>
<time>2002-01-15T10:01:36</time>
<temp>-9.4</temp>
<wspd>10.0</wspd>
<rain>5</rain>
</weather>
</weatherdata>
style-fil(vaer.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/weather">
<h1>Weather in <xsl:value-of select="city"/></h1>
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<th align="left">Time</th>
<td><xsl:value-of select="time"/></td>
</tr>
<tr>
<th align="left">Temperature</th>
<td><xsl:value-of select="temp"/></td>
</tr>
<tr>
<th align="left">Wind speed</th>
<td><xsl:value-of select="wspd"/></td>
</tr>
<tr>
<th align="left">Rain</th>
<td><xsl:value-of select="rain"/></td>
</tr>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Se resultat(krever IE5 eller nyere)