这是 .xml 文件,他通过 DTD 文档进行验证:
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="./curric.xslt"?>
<!DOCTYPE radice SYSTEM "Curriculum.dtd">
<radice>
<curriculum>
<dati>
<nome>Luca</nome>
<cognome>Rossi</cognome>
<sesso>Maschile</sesso>
<indirizzo>
<via>Via Degli Angeli 35</via>
<cap>21057</cap>
<city>Olgiate Olona</city>
<provincia>VA</provincia>
<nazione>Italia</nazione>
</indirizzo>
<telefono>03313434322</telefono>
<posta>rossi@mail.com</posta>
</dati>
<studi>
<maturita>
<titolo>Maturita' Scientifica</titolo>
<voto>48/60</voto>
</maturita>
<laurea>
<universita>Statale di Milano</universita>
<facolta>Informatica</facolta>
<votol>110</votol>
</laurea>
</studi>
<esperienze>Da 3 anni responsabile tecnico "Inforscuola"</esperienze>
<lingua>Inglese</lingua>
</curriculum>
</radice>
它是 .xslt 文件:
<?xml version="1.0"?>
<HTML xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<BODY STYLE="font-family:Arial, helvetica, sans-serif; font-size:22pt">
<xsl:for-each select="radice/curriculum">
<DIV STYLE="background-color:teal; color:white; margin-bottom:0.5em">
<xsl:value-of select="dati/nome"/>
<xsl:value-of select="dati/cognome"/>
</DIV>
<DIV STYLE="margin-left:20px; margin-bottom:1em; font-size:18pt;font-style:italic">
Indirizzo: <xsl:value-of select="dati/indirizzo/via"/>
<DIV STYLE="margin-left:100px;font-style:italic;font-size:18pt">
<xsl:value-of select="dati/indirizzo/cap"/>
<SPAN>
<xsl:value-of select="dati/indirizzo/city"/>
</SPAN>
<SPAN>
<xsl:value-of select="dati/indirizzo/provincia"/>
</SPAN>
</DIV>
<DIV> Telefono:<xsl:value-of select="dati/telefono"/>
</DIV> E-mail :<xsl:value-of select="dati/posta"/>
</DIV>
<DIV STYLE=" font-size:24;font-style:verdana;color:black;background-color:#EEEEEE">
Studi</DIV>
<xsl:for-each select="studi/maturita">
<DIV STYLE="font-style:arial; color:black;font-size:18pt;
margin-top:1em;margin-left:20px">
Media Superiore: <SPAN STYLE="color:teal">
<xsl:value-of select="titolo"/>
</SPAN> - Voto : <SPAN STYLE="color:teal"&g;>
<xsl:value-of select="voto"/>
</SPAN>
</DIV>
</xsl:for-each>
<xsl:for-each select="studi/laurea">
<DIV STYLE="font-style:arial; color:black;font-size:18pt; margin-left:20px">
Universita': <SPAN STYLE="color:teal">
<xsl:value-of select="universita"/>
</SPAN> - Corso di Laurea: <SPAN STYLE="color:teal">
<xsl:value-of select="facolta"/>
</SPAN> - Voto : <SPAN STYLE="color:teal">
<xsl:value-of select="votol"/>
</SPAN>
</DIV>
</xsl:for-each>
<DIV STYLE="background-color:#EEEEEE; color:black; margin-top:1em; font-size:24">
Esperienze Lavorative </DIV>
<DIV STYLE="font-style:italic; color:teal;font-size:18pt;
margin-top:0.5em; margin-left:20px">
<xsl:value-of select="esperienze"/>
</DIV>
<DIV STYLE="background-color:#EEEEEE; color:black; margin-top:0.5em; font-size:24">
Lingua Straniera </DIV>
<DIV STYLE="font-style:italic; color:teal;font-size:18pt; margin-top:0.5em;
margin-bottom:2em; margin-left:20px">
<xsl:value-of select="lingua"/>
</DIV>
</xsl:for-each>
</BODY>
</HTML>
文件位于本地的同一目录中,并且在浏览器上运行 .xml 文件时显示:“加载样式表时出错:解析 XSLT 样式表失败。”