[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: unparsed CDATA maintain HTML

Subject: RE: unparsed CDATA maintain HTML
From: "George @dante" <dantetools@xxxxxxxxxxx>
Date: Mon, 15 Dec 2003 01:16:03 +0000
xsl copy of cdata
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"?>

<doc>

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




</doc>

So now I understand that the following stylesheet

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xhtml="http://www.w3.org/1999/xhtml"
 xmlns:m="http://www.w3.org/1998/Math/MathML"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 xmlns:xalan="http://xml.apache.org/xalan"
 xmlns:om="http://www.openmath.org/OpenMath"
 xmlns:exsl="http://exslt.org/common"
 extension-element-prefixes="exsl"
 version="1.0">


<xsl:output method="xml" doctype-public="-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" doctype-system="http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"/>


<xsl:template match="/">
  <html>
    <xsl:apply-templates/>
   </html>
</xsl:template>


<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
</tr></table></text>

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=".">
 </xsl:copy-of>
</xsl:template>

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="...">
 ...
</span>

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

George

ps.
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 http://www.msn.co.uk/specials/btbroadband



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.