I wonder if anybody could help me please with a tricky problem I am having. Probably asking the impossible here but would be interested to hear any suggestions.
I have an XML file that in one of the nodes contains the HTML of a page. I would like to take the data in that node and some how create an HTML file from it. So, from the example XML below, I want to transform and pick cell[2] node from //dvm/rows/row and place that in another file so that I can actually see what that HTML mark-up shows and display as a proper web page rather than the code.
If I put it in and XSL like this, would it work?
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="html"/>
<xsl:template match="/">
<xsl:value-of select="//dvm/rows/row/cell[2]" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
The XML is:
<dvm>
<description>This is a DVM file</description>
<columns>
<column name="lang"/>
<column name="text"/>
<column name="code" qualifier="true" order="1"/>
<column name="type" qualifier="true" order="2"/>
<column name="subj"/>
<column name="urem"/>
<column name="vreq"/>
</columns>
<rows>
<row>
<cell>English(UK)</cell>
<cell><![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My HTML File</title>
</head>
<body>
<div class="text">
<p>This is a line of text</p>
<p>This is a line of text</p>
<p>This is a line of text</p>
</div>
</body>
</html>]]>
</cell>
<cell>Code 1</cell>
<cell>Text</cell>
<cell>HTML Block 1</cell>
<cell/>
<cell/>
</row>
</rows>
</dvm>