L
Luke Dalessandro
I have some XML data that has mixed content XML tags that embed XHTML
tags, for instance:
<note>Somebody wrote this note in XHTML and wanto to <a
href="link.html" target="_new">link</a> to a particular tag, and was
also pretty sure that they wanted the following
<ul><li>two</li><li>items</li></ul> to appear as a list. To make
matters worse <sarcastic>how could this be worse?</sarcastic>, the
XHTML can be mixed with our own tags.</note>
I am trying to transform this data with an XSLT into oddly formated
XHTML for display (I happen to be doing it server-side, with ASP.NET
2.0). The problem is that I need to preserve all of the embedded XHTML
tags in the XML document, while writing templates for all of our
custom content.
The only thing that I have successfully done so far is to write my own
templates for all of the XHTML tags, that output themselves and
process their children, for instance:
<xsl:template match="//b">
<b><xsl:apply-templates /></b>
</xsl:template>
There are way too many XHTML tag possibilities for me to handle though
(and I have to deal with all of the possible attributes, and output
them correctly too).
Is there a better way to do this, or if there isn't, does anyone have
an XSLT document that handles all (or most) of the XHTML tags that I
can include? I can force everyone to use namespaces if necessary (ie
<xhtml:b></xhtml:b>).
Desperately seeking help,
Luke Dalessandro
tags, for instance:
<note>Somebody wrote this note in XHTML and wanto to <a
href="link.html" target="_new">link</a> to a particular tag, and was
also pretty sure that they wanted the following
<ul><li>two</li><li>items</li></ul> to appear as a list. To make
matters worse <sarcastic>how could this be worse?</sarcastic>, the
XHTML can be mixed with our own tags.</note>
I am trying to transform this data with an XSLT into oddly formated
XHTML for display (I happen to be doing it server-side, with ASP.NET
2.0). The problem is that I need to preserve all of the embedded XHTML
tags in the XML document, while writing templates for all of our
custom content.
The only thing that I have successfully done so far is to write my own
templates for all of the XHTML tags, that output themselves and
process their children, for instance:
<xsl:template match="//b">
<b><xsl:apply-templates /></b>
</xsl:template>
There are way too many XHTML tag possibilities for me to handle though
(and I have to deal with all of the possible attributes, and output
them correctly too).
Is there a better way to do this, or if there isn't, does anyone have
an XSLT document that handles all (or most) of the XHTML tags that I
can include? I can force everyone to use namespaces if necessary (ie
<xhtml:b></xhtml:b>).
Desperately seeking help,
Luke Dalessandro