I need help transforming an XML file, whose part of it is with escape sequences, into HTML:
<?xml-stylesheet type=text/xsl href=XSL_17.xsl?>
<Root>
<Book>
<Author>John smith</Author>
<Genre>Novel</Genre>
<Details><?xml version="1.0" encoding="utf-16"?><Dets><Ds><D DN="Pages" DV="381" /><D DN="Binding" DV="Hardcover" /><D DN="Rate" DV="7.8" /></Ds></Dets></Details>
</Book>
<Car>
<Year>2010</Year>
<Name>Charger</Name>
<Manufacturer>Dodge</Manufacturer>
</Car>
</Root>
to the following HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<table>
<tr>
<td><strong>Book</strong></td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td><strong>Value</strong></td>
</tr>
<tr>
<td>Author</td>
<td>John smith</td>
</tr>
<tr>
<td>Genre</td>
<td>Novel</td>
</tr>
<tr>
<td>Details</td>
<td>
<table>
<tr>
<td><strong>Name</strong></td>
<td><strong>Value</strong></td>
</tr>
<tr>
<td>Pages</td>
<td>381</td>
</tr>
<tr>
<td>Binding</td>
<td>Hardcover</td>
</tr>
<tr>
<td>Rate</td>
<td>7.8</td>
</tr>
</table>
</td>
</tr>
</table>
<table>
<tr>
<td><strong>Car</strong></td>
</tr>
<tr>
<td><strong>Name</strong></td>
<td><strong>Value</strong></td>
</tr>
<tr>
<td>Year</td>
<td>2010</td>
</tr>
<tr>
<td>Name</td>
<td>Charger</td>
</tr>
<tr>
<td>Manufacturer</td>
<td>Dodge</td>
</tr>
</table>
</body>
</html>
I.e., I need to represent both normal XML and escaped XML in HTML tables.
This XSLT produces the output desired
This cannot be done with XSLT unless one implements an XML parser in XSLT.
If you have Saxon, you can use the Saxon extensions
saxon:parse()
andsaxon:transform()