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

Re: CDATA question

Subject: Re: CDATA question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 14 Apr 2004 22:57:52 +0100
cdata style
<xsl:template match="emphasis">
 <b><xsl:apply-templates/></b>
</xsl:template>

That would generate a b element in the output, but you don't want a b
element you want

<xsl:template match="emphasis">
 &lt;b&gt;<xsl:apply-templates/>&lt;/b&gt;
</xsl:template>

as what you want is

<mattext texttype="text/html"><![CDATA[Select the <b>GPO Part Additional
Info</b> link in the <b>Navigation</b>screen.]]></mattext>


which is the same thing as

<mattext texttype="text/html">Select the &lt;b>GPO Part Additional
Info&lt;/b> link in the &lt;b>Navigation</b>screen.</mattext>

The difference between using CDATA and using &lt; should be seen as a
purely syntactic artifact with no difference in meaning just as using "
or ' around attribute values has no effect on the meaning.
So you use the same xslt templates in either case, and just request the
CDATA style of linearisation.

Since you have used 

cdata-section-elements="mattext feedback">

The text node will be output in CDATA style (even if entered using &lt;)
but you have to create a single text node, not a a tree of elements and
attributes. 

Of course better, if you have any control over the output format, is not
to use a CDATA section and to have elements in there. Since that <b> is
presumably intended to be markup, it's slightly peverse (although
depressingly common) to declare that it is _not_ markup but C(haracter )Data.


David


-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.