RE: [xsl] unparsed CDATA maintain HTML

Subject: RE: [xsl] unparsed CDATA maintain HTML
From: "George @dante" <dantetools@xxxxxxxxxxx>
Date: Mon, 15 Dec 2003 01:16:03 +0000
Hmmm... could you post a bit more elaborate version of the source and
desired target?

Yes thanks I attach it at the end ...

Just having a bit of difficulty seeing the problem here. If
I try a template with xsl:copy-of, this gives me an identical copy of the
source node it is being used on, including attributes,

sorry that was my fault with some early tries of xsl:copy

and, if specified
correctly in the source document, it will also copy the namespace and
respective prefixes.

I would really appreciate your help specifying them correctly in this case:

part of the XML file:

<?xml version = "1.0" encoding = "UTF-8"?>


This is some <i>italic</i> and a table <table align="center"><tr><td>hello</td></tr></table></text>


So now I understand that the following stylesheet

<xsl:stylesheet xmlns:xsl="";

<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" doctype-system=""/>

<xsl:template match="/">

<xsl:template match="text"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>

does produce a copy of the text element with the <i>s and <tables>s etc appropriately copied
but I have this problem with the xmlns

<text xmlns="">
This is some <i>italic</i> and a table <table align="center"><tr><td>hello</t

which is only avoided if one uses namespaces for the HTML element.

Also I am not sure if I want to keep this <text> element there (maybe its name should be changed if possible to something more xthml-ish or better I did:

<xsl:template match="text"> <xsl:copy-of select="."/> </xsl:template>

<xsl:template match="font">
 <xsl:copy-of select=".">

but this would mean that I need to write templates for alll possible HTML elements ?
(which i will at some point when I clearly specify my XML files but this is another story)

Could we find a way round that and instead of copying text create a new element say

<span xmlns="...">

That would have the copy of the text element of the first XML file .. something like copying into differnt namespaces ?

I hope I make sense ... I am rather excausted goodnight


This reminds me the reason that I use CDATA as this dirty bit of XML there is like a hack as th DTD doesn't allow HTML elements :-) but that's another issue

Tired of 56k? Get a FREE BT Broadband connection

XSL-List info and archive:

Current Thread