xsl-list
[Top] [All Lists]

xslt a mixed html and xml file

2004-06-14 04:19:06
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



<Prev in Thread] Current Thread [Next in Thread>