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

RE: how to close html tags : link, meta,...

Subject: RE: how to close html tags : link, meta,...
From: "Andrew Welch" <AWelch@xxxxxxxxxxxxxxx>
Date: Wed, 13 Aug 2003 09:30:06 +0100
div close
> > hi,
> > i'm using xslt to transform an xml file into a html file
> > my problem is that i really need to have the empty tags( meta, link,
> > img,...) closed and I don't know how to do this...
> In which case you shouldn't transform to HTML. Use the "xml" output
> method:
> <xsl:output method="xml" />

You will discover that using the xml output method will solve this
particular issue, but cause you no end of html style issues, such as:

<div style="background:blue">

Will make everything after the outer <div> have a blue background.  Of
course this is perfectly legal xml, and to any xml aware receiving
application <div/> and <div></div> are identical - but not to IE.  IE
will treat the empty element <div/> as an opening tag, the following
</div> as its closing tag, and then everything that follows as children
of the outer <div style="background:blue">.

The only way to use the xml output method is to ensure each html tag
doesn't get minimised, usually by placing a &_#160; in each template.

This leads to formatting issues - say you really do wan't a blue
background, you will notice lots of spaces with blue backgrounds.  Or
simply extra white space in the output.

So you could use a zero width space, but make sure your encoding and
font supports it.  If that's not an option, you need to use an
expression in the form of:


Which is still a pain (and has a processing expense) but at least your
output will look fine.

Soon, (maybe now?) you will be able to use Saxon's xslt 2.0 xhtml output
method with the backwards-compatibility mode @version="1.0" on your xslt
1.0 stylesheets, which will solve this issue.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.