Subject: RE: [xsl] Preventing tags from collapsing From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx> Date: Fri, 15 Apr 2005 10:12:25 +0100 |
> In our case it turns out that it is XML transforms happening > long before > XSL comes on the scene that are causing the minimisation. > > Although, I suppose we could then use XSL to find nodes with > no content, > and then 'un-minimise' them by inserting some comments text. > Hmm.. it's > worth a go I suppose. Yes - the part you are concerned with here is the way that the result tree (the result of the transformation) gets serialised. XSLT operates on a source tree created by the XML parser - XSLT doesn't know whether in the XML the element was written as <foo/> or <foo></foo>, all it sees is a node in a tree. Equally in the result tree a node is just a node, only when that node gets serialised is there any influence over whether the node gets written out as <foo/> or <foo></foo>. XSLT generates the result tree, the serialiser operates on the result tree to produce the output. If you have specified the HTML output method, then the serialiser checks against a set of rules and will write out HTML elements correctly eg <meta> with no closing tag as it is defined as EMPTY in the HTML DTD. If you have specified the XHTML output method of 2.0 then the serialiser will write out <meta /> as an empty XML element, as that how it defined in XHTML. The key to remember here is that in XML <foo/> and <foo></foo> are identical - it's only when we send XML to the HTML parser in IE that it becomes significant. cheers andrew
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Preventing tags from coll, Andrew Welch | Thread | Re: [xsl] Preventing tags from coll, ben senior |
RE: [xsl] Preventing tags from coll, Andrew Welch | Date | Re: [xsl] Preventing tags from coll, ben senior |
Month |