Subject: RE: [xsl] Fixing &lt;b&gt; 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 &lt;b&gt; tammy@xxxxxxxx wrote: > Hi all! > > I've got data that looks like: > > <body> > <p>&lt;b&gt;Some Text&lt;/b&gt;&lt;p&gt; > &lt;i&gt;Some More Text&lt;/i&gt;&lt;p&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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Fixing &lt;b&gt;, Michael Kay | Thread | RE: [xsl] Fixing &lt;b&gt;, tammy |
Re: [xsl] Fixing &lt;b&gt;, Mike Brown | Date | [xsl] Xinclude prob, Jarkko Moilanen |
Month |