Re: [xsl] CData escaping

Subject: Re: [xsl] CData escaping
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 06 Feb 2002 12:54:04 -0500
Paul,

Before we tell you how to do this, tell us why you want to so we can put on our Thought Police uniforms to tell you why it's not a good idea.

Really -- 99 times out of a hundred, this is a very poor solution to a common problem that has better solutions. And it's a FAQ.

For example -- let's say your problem is that your input

<one>1</one>
<two>2</two>
<one>3</one>
<two>4</two>
<one>5</one>
<two>6</two>

needs to come back as

<pair>
  <one>1</one>
  <two>2</two>
</pair>
<pair>
  <one>3</one>
  <two>4</two>
</pair>
<pair>
  <one>5</one>
  <two>6</two>
</pair>

A clean, conformant solution is

<xsl:template match="one">
  <pair>
    <xsl:copy-of select="."/>
    <xsl:copy-of select="following-sibling::two[1]"/>
  </pair>
</xsl:template>

<xsl:template match="two"/>

But what you want to do will not work in all XSL implementations, and is not required by the spec to be supported by a processor.

Cheers,
Wendell

Cheers,
Wendell

At 12:33 PM 2/6/02, you wrote:
Hi all,
 Very simply, I'm trying to do the following:

<![CDATA[</i>]]>

but the < and > are being escaped as &lt; and &gt; in the output which is
not what I want. How do output the symbols themselves? My output method is
html and I'm using xalan 1.2.

Thanks in advance,
Paul Brady.




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


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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



Current Thread