[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] MSXML, xsl:copy, XML Output and BR tags.
Hi all, I have an annoying problem that I can't seem to solve - any help appreciated! I am using MSXML3 and doing the transformation from within code using the DOM. I have a source XML doc which contains data I later wish to render in a browser that includes a number of <br /> tags. When I transform the data using a simple identity transformation to copy the entire tree, all of the <br /> tags get changed to <br></br> by the <xsl:copy> I am using. Actually, the same thing seems to happen for all tags like this (such as <img /> etc.) Obviously, <br></br> is still valid XML, but IE and Netscape both render these as TWO breaks in the browser, not the single one that I require. I realise this is probably parser implementation specific. Any ideas how can I make the XSL transformation leave the <br /> as it is?? I really do not want to use <xsl:output method="html"> since I wish to have the data preserved as XHTML for later manipulation... Example Source Doc (the simplest one possible!!): <?xml version="1.0"?> <filecontent><br /></filecontent> XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" /> <xsl:template match='@* | node()'> <xsl:copy><xsl:apply-templates select='@* | node()'/></xsl:copy> </xsl:template> </xsl:stylesheet> As an experiment I added <xsl:template match="br"><br /></xsl:template> to the stylesheet and this worked fine. Again, if I can help it, I'd rather not have to add a template for each "problem" HTML tag...! Thanks in advance, PH XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|