DTD a dins de l'arxiu XML:
<?xml version="1.0"?><!DOCTYPE classe [<!ELEMENT classe (professor, alumnes)><!ELEMENT professor (#PCDATA)><!ELEMENT alumnes (nom*)><!ELEMENT nom (#PCDATA)>]><classe></classe><?xml version="1.0"?><!DOCTYPE people_list SYSTEM "people_list.dtd"><people_list> <person> <name>Sofia</name> <birthdate>13/11/1975</birthdate> <gender>male</gender> </person> <person> <name>Peter</name> <gender>male</gender> <socialsecuritynumber>238728923667</socialsecuritynumber> </person></people_list><?xml version="1.0"?><!DOCTYPE list SYSTEM "simple_recipe.dtd"><list> <recipe> <author>Carol Schmidt</author> <recipe_name>Chocolate Chip Bars</recipe_name> <meal>Dinner</meal> <ingredients> <item>2/3 C butter</item> <item>2 C brown sugar</item> <item>1 tsp vanilla</item> <item>1 3/4 C unsifted all-purpose flour</item> <item>1 1/2 tsp baking powder</item> <item>1/2 tsp salt</item> <item>3 eggs</item> <item>1/2 C chopped nuts</item> <item>2 cups (12-oz pkg.) semi-sweet choc. chips</item> </ingredients> <directions> Preheat oven to 350 degrees. Melt butter; combine with brown sugar and vanilla in large mixing bowl. Set aside to cool. Combine flour, baking powder, and salt; set aside. Add eggs to cooled sugar mixture; beat well. Stir in reserved dry ingredients, nuts, and chips. Spread in greased 13-by-9-inch pan. Bake for 25 to 30 minutes until golden brown; cool. Cut into squares. </directions> </recipe> </list><?xml version='1.0' encoding='UTF-8'?><!DOCTYPE note SYSTEM "note.dtd"><note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body></note><!ELEMENT note (to,from,heading,body)><!ELEMENT to (#PCDATA)><!ELEMENT from (#PCDATA)><!ELEMENT heading (#PCDATA)><!ELEMENT body (#PCDATA)> <?xml version='1.0' encoding='UTF-8'?><note xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="note.xsd"> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body></note><?xml version='1.0' encoding='UTF-8'?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema><?xml version = "1.0"?><?xml-stylesheet type="text/xsl" href="students.xsl"?> <class> <student rollno = "393"> <firstname>Dinkar</firstname> <lastname>Kad</lastname> <nickname>Dinkar</nickname> <marks>85</marks> </student> <student rollno = "493"> <firstname>Vaneet</firstname> <lastname>Gupta</lastname> <nickname>Vinni</nickname> <marks>95</marks> </student> <student rollno = "593"> <firstname>Jasvir</firstname> <lastname>Singh</lastname> <nickname>Jazz</nickname> <marks>90</marks> </student> </class><?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> <th>Last Name</th> <th>Nick Name</th> <th>Marks</th> </tr> <xsl:for-each select="class/student"> <tr> <td> <xsl:value-of select = "@rollno"/> </td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><xsl:value-of select = "marks"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet><?xml version = "1.0"?><?xml-stylesheet type="text/xsl" href="students2.xsl"?> <class> <student rollno = "393"> <firstname>Dinkar</firstname> <lastname>Kad</lastname> <nickname>Dinkar</nickname> <marks> <mark>45</mark> <mark>67</mark> <mark>88</mark> </marks> </student> <student rollno = "493"> <firstname>Vaneet</firstname> <lastname>Gupta</lastname> <nickname>Vinni</nickname> <marks> <mark>64</mark> <mark>79</mark> <mark>67</mark> </marks> </student> <student rollno = "593"> <firstname>Jasvir</firstname> <lastname>Singh</lastname> <nickname>Jazz</nickname> <marks> <mark>94</mark> <mark>33</mark> <mark>81</mark> </marks> </student> </class><?xml version = "1.0" encoding = "UTF-8"?><xsl:stylesheet version = "1.0" xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"> <xsl:template match = "/"> <html> <body> <h2>Students</h2> <table border = "1"> <tr bgcolor = "#9acd32"> <th>Roll No</th> <th>First Name</th> <th>Last Name</th> <th>Nick Name</th> <th>Marks</th> </tr> <xsl:for-each select="class/student"> <tr> <td> <xsl:value-of select = "@rollno"/> </td> <td><xsl:value-of select = "firstname"/></td> <td><xsl:value-of select = "lastname"/></td> <td><xsl:value-of select = "nickname"/></td> <td><ul> <xsl:for-each select="marks/mark"> <li><xsl:value-of select = "text()"/></li> </xsl:for-each> </ul></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>