RE: [xsl] Fixing <b>

Subject: RE: [xsl] Fixing <b>
From: Lea Allison <Lea.Allison@xxxxxxxxxxxxxx>
Date: Wed, 27 Mar 2002 07:13:00 +0100
Very helpful Mike.


-----Original Message-----
From: Mike Brown [mailto:mike@xxxxxxxx]
Sent: Wednesday 27 March 2002 04:50
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Fixing &amp;lt;b&amp;gt;


tammy@xxxxxxxx wrote:
> Hi all!
> 
> I've got data that looks like:
> 
> <body>
>   <p>&amp;lt;b&amp;gt;Some Text&amp;lt;/b&amp;gt;&amp;lt;p&amp;gt;
>   &amp;lt;i&amp;gt;Some More Text&amp;lt;/i&amp;gt;&amp;lt;p&amp;gt;
>   </p>
> </body>
> 
> And I need it to convert it to this:
> 
> <body>
>   <p><b>Some Text</b><p/>
>   <i>Some More Text</i><p/>
>   </p>
> </body>
> 
> I appreciate your help on this.
> 
> Tammy Kohl

1. This is a FAQ. When people ask this question, it indicates they do not
understand some fundamental concepts of XML, XSLT and the XPath/XSLT data
model.

2. There is a way to do exactly what you want, but the solution that some
would recommend (disable-output-escaping) is not guaranteed to be portable,
and is bad form because...

3. You're abusing XML and XPath, pretending an innocuous blob of character
data is actually structured markup that needs to be parsed.

Where is the escaped data coming from? Why was it escaped in the first
place?
Because it's not well-formed XML? It's generally considered "bad" to embed
HTML in XML as character data (which essentially obscures the fact that it
is
markup), and then try to extract it and emit it as actual HTML markup, using
XPath/XSLT. XSLT is about tree walking, tree building and automatic tree
serialization... not string parsing and string concatenation.

   - Mike
____________________________________________________________________________
  mike j. brown                   |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  resume: http://skew.org/~mike/resume/

 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
  • [xsl] Fixing &amp;lt;b&amp;gt;
    • tammy - Tue, 26 Mar 2002 18:55:32 -0800 (PST)
      • <Possible follow-ups>
      • Lea Allison - Wed, 27 Mar 2002 07:13:00 +0100 <=
      • tammy - Wed, 27 Mar 2002 03:48:54 -0800 (PST)
        • naha - Wed, 27 Mar 2002 09:13:34 -0500 (EST)
        • Mike Brown - Wed, 27 Mar 2002 20:01:44 -0700 (MST)