xslt a mixed html and xml file

Subject: xslt a mixed html and xml file
From: "Stephen Tredrea" <stephen.tredrea@xxxxxxxxxxxxx>
Date: Mon, 14 Jun 2004 13:19:06 +0200
Hi

Given this XML (which is a mixture of standard HTML tags and custom
tags)...:

<?xml version="1.0" encoding="utf-8"?>
<table>
<tr>
	<td>bla bla bla</td>
	<td>
		<link>
			<innerHTML>One</innerHTML>
			<href>http://somewhere.com/</href>
		</link>
	</td>
</tr>
</table>

... I want to apply a style sheet that outputs the HTML as it is but also
applies templates to the custom bits.

Obviously, without the custom bits the style sheet would be:

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

<xsl:template match="/">
	<xsl:copy-of select="*" />  <!-- "*" or "."? -->
</xsl:template>

...but I need to add in this WITHOUT changing the XML:

<xsl:template match="link">
	<a href="<xsl:value-of select="href" />">
		<xsl:value-of select="innerHTML" />
	</a>
</xsl:template>

Hoping there's a simple and elegant solution, Stephen


Current Thread