PRB: XML/XSL Render Tags as Empty-Element Tag When an Attribute Is Added with No Content (251145)
The information in this article applies to:
- Microsoft XML 2.0
- Microsoft XML 2.5
- Microsoft XML 2.6
- Microsoft XML 3.0
- Microsoft XML 4.0
This article was previously published under Q251145 SYMPTOMS
When you use XSL to add an attribute without any content between the start tag and the end tag, the Microsoft XML parser, MSXML, will render it as empty-element tag.
CAUSE
MSXML is trying to generate well-formed HTML without knowledge of HTML's requirement that some elements need end tags and some don't. MSXML performs heuristics that try to evaluate whether there was an attempt to add content to the tag, and if so it produces separate start and end tags. This works reasonably well, but it can be thrown off by the use of <xsl:attribute> when creating empty HTML elements that require end tags.
The XSLT Recommendation (see "References" section) addresses this problem by allowing stylesheets to output legal HTML. The XHTML Candidate Recommendation addresses this problem by promoting HTML parsers to recognized well-formed markup.
RESOLUTION
Adding an empty CDATA tag in between the start tag and the end tag immediately after the attributes will resolve the problem.
STATUS
This behavior is by design.
REFERENCESFor more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
Modification Type: | Major | Last Reviewed: | 5/11/2006 |
---|
Keywords: | kbprb KB251145 |
---|
|