[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

MSXML, xsl:copy, XML Output and BR tags.

Subject: MSXML, xsl:copy, XML Output and BR tags.
From: "Paul Hammond" <paul@xxxxxxxxxxxxxxx>
Date: Thu, 5 Apr 2001 14:29:17 +0100
msxml xsl output
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.