Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - How do I convert a HTML tag to a XHTML tag in XSL? [Thread Next] Re: How do I convert a HTML tag to a XHTML tag in XSL?To: NULL Date: 10/10/2007 10:24:00 PM Frank Peterson wrote: > I need to convert the <BR> in the following XML file to <br /> but I > cant figure out how. There is no such tag as <BR> in that file. It's in a CDATA section so it isn't markup: it's just a less-than sign, a B, an R, and a greater-than sign. This is why using CDATA sections for "hiding" or "passing" markup is almost always wrong, and the result of insufficient understanding of the nature of the problem. See http://xml.silmaril.ie/authors/cdata/ > XML: [snip] > <details> <![CDATA[ The couple enjoyed a week-long honeymoon in > Cancun, Mexico.<BR> And now reside in Los Angeles ]]> </details> The only way around it now is to write an XSLT template for text() and test it recursively for the presence of the string "<BR>", then output the substring-before and "<br/>" and pass the the substring-after through to the next cycle. To avoid this in the future, don't allow the creator to embed SGML-style EMPTY elements in XML text. Turn them into XML first, and then there is no need to use the CDATA. It can be hard when you have to deal with poor quality data sources, but that's what pattern-matching stream editors are for :-) ///Peter | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
