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

RE: xsl and xml CDATA or Not question

Subject: RE: xsl and xml CDATA or Not question
From: "John Hamman" <John@xxxxxxxxxxxxxxxxx>
Date: Fri, 12 Mar 2004 15:21:14 -0500
xml cdata br
Thanks for your info. 
 Currently the xml is like this.
<?xml version="1.0" encoding="UTF-8"?>
<iThink.ePulp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Page id="somepageid" version="1.0" published="1.0" current="1.0">
		<Content>
			<br/>
		</Content>
	</Page>
</iThink.ePulp>

For example the <br/> is coming out <br xmlns=""/>
So what do I need to do if my xsl is like so.

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="remove">
	<xsl:output method="xml" indent="yes" encoding="utf-8"
omit-xml-declaration="yes"/>
	<xsl:template match="/">
		<xsl:apply-templates/>
	</xsl:template>
	
	<xsl:template match="Page" xml:space="preserve">
		
			<head>
		
			</head>
			<body>
				<xsl:apply-templates select="Content"/>
			</body>
		</html>
	</xsl:template>
<xsl:template match="Content" xml:space="preserve">
	<xsl:apply-templates />
</xsl:template>


<xsl:template match="br | BR">
	<xsl:apply-templates /><br />
</xsl:template>


	
</xsl:stylesheet>















-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Michael Kay
Sent: Friday, March 12, 2004 3:00 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  xsl and xml CDATA or Not question

If the system writes <xyz xmlns=""> that's because you have generated the
<xyz> element in the null namespace. If you don't want the xmlns=""
undeclaration, that's probably because you want the <xyz> element to be in a
non-null namespace. So you need to change the code that generates the <xyz>
element, to put it in the right namespace. The xmlns="" will then magically
disappear.

Michael Kay

# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-
# list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of John Hamman
# Sent: 12 March 2004 18:11
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: RE:  xsl and xml CDATA or Not question
# 
# Woohoo. I got almost everything I wanted. Thanks for all the help guys.
# Now whats left is to remove the 'xmlns=""' that is put in a lot of the
# code.
# Any suggestions?
# 
# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of John Hamman
# Sent: Friday, March 12, 2004 12:22 PM
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: RE:  xsl and xml CDATA or Not question
# 
# Thanks for your reply and help.
# The extra </a> was left in by accident. I removed some code that didn't
# need
# to be there in the <p> .
# Forgive me for my improper terminology. I have now removed the CDATA and
# am
# using xsl:copy-of.
# But my problem is not rendering the Formated version, which comes out
# perfect. My problem is in the text only XLS version.
# 
# This is my current code with extras taken out to save room.
# 
# <xsl:stylesheet version="1.0"
# xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asp="remove">
# 	<xsl:output method="xml" indent="yes" encoding="utf-8"
# omit-xml-declaration="yes"/>
# 	<xsl:template match="/">
# 		<xsl:apply-templates/>
# 	</xsl:template>
# 	<xsl:template match="Page" xml:space="preserve">
# 		<xsl:text disable-output-escaping="yes">
# 			<html xmlns="http://www.w3.org/1999/xhtml">
# 			<head>
# 			</head>
# 			<body>
# 				<xsl:apply-templates select="Content"/>
# 			</body>
# 		</html>
# 	</xsl:template>
# <xsl:template match="Content" xml:space="preserve">
# 	 <xsl:copy-of select="node()"/>
# </xsl:template>
# 
# <xsl:template match="//*/img">
# 	<xsl:for-each select="@*">
# 	[image: <xsl:value-of select="." />]
# 		<xsl:if test="((name()='alt') or (name()='ALT') or
# (name()='Alt')) and (normalize-space(.)!='')">
# 			[image: <xsl:value-of select="." />]
# 		</xsl:if>
# 	</xsl:for-each>
# 	<xsl:apply-templates />
# 
# 	</xsl:template>
# </xsl:stylesheet>
# 
# 
# 
# -----Original Message-----
# From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Peter Flynn
# Sent: Friday, March 12, 2004 11:57 AM
# To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
# Subject: Re:  xsl and xml CDATA or Not question
# 
# On Fri, 2004-03-12 at 15:49, John Hamman wrote:
# > hello experts,
# > If i have some html in a xml field like below.
# 
# XML doesn't have "fields" -- they're for databases.
# XML has elements.
# 
# > <Content><![CDATA[ <br/><br/><center><div id="TextOnlyLink"><a
# > href="/page.aspx?textonly">[Text Only]</a></div>
# > <div id="centerImg">
# > <img src="/pub/en-us/images/clear-path-soon.jpg" alt="the alt tag."
# > width="712" height="223"/>
# > </div>
# > <p>blah blah blah</a>
# > </p>
# > </center>]]>
# > </Content>
# 
# But that isn't HTML any more. Putting it in a CDATA section
# means you want it treated as plain text. That's what CDATA
# sections are for. What is wrong with (indents added for
# illustration only):
# 
#   <Content>
#     <br/>
#     <br/>
#     <center>
#       <div id="TextOnlyLink">
#         <a href="/page.aspx?textonly">[Text Only]</a>
#       </div>
#       <div id="centerImg">
#         <img src="/pub/en-us/images/clear-path-soon.jpg"
#           alt="the alt tag" width="712" height="223"/>
#       </div>
#       <p>blah blah blah*</p>
#     </center>
#   </Content>
# 
# * I've removed the spurious </a> which must be a corruption.
# If you are being supplied with this by someone else, tell
# them to generate well-formed XHTML otherwise it can't be
# processed. They've taken the trouble to add the / at the
# end of the <img/> element, so I'm not clear why they felt
# it important to add a meaningless </a> and then deliberately prevent it
# being used as XHTML.
# 
# > my formated xsl is just this
# > <xsl:value-of select="//Content" disable-output-escaping="yes"/>
# 
# With the above you can use the xsl:copy-of that David
# suggests.
# 
# > but my question is how do i take that contnet and be able to use it in a
# way
# > with another "text only" xsl sheet that might make it output like this
# >
# > <a href="/page.aspx">[Formated]</a>
# > [img: the alt tag]
# > <p>blah blah blah<p>
# 
# Tip: alt is not a tag, it's an attribute on the img element type.
# 
# > Any ideas. Im sure im missing something somewhere. Should i get rid of
# the
# > CDATA and figure a way to output it as regular HTML in the formated
# version?
# 
# Yes. If it's XHTML, then handle it as such.
# 
# ///Peter
# 
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
# 
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
# 
# 
# 
#  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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



 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.