This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fixing <b>


tammy@kohl.com 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]