55

image Converting XML to HTML with XSLT

This tutorial shows how to convert a raw XML document in XHTML. First, we start with a simple XML file (superhero.xml) that contains a link to the transformation stylesheet.

<?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="superhero.xsl"?> <league>  <superhero>    <name>Batman</name>    <alias>Bruce Wayne</alias>  </superhero>  <superhero>    <name>Superman</name>    <alias>Clark Kent</alias>  </superhero></league>

Now we need to create an XSL stylesheet (superhero.xsl) with transformation rules:

<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ...

Get Developing Quality Metadata now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.