[xsl] Self-closing elements upset some browsers

Subject: [xsl] Self-closing elements upset some browsers
From: "Marroc" <marrocdanderfluff@xxxxxxxxxxx>
Date: Thu, 13 Mar 2008 13:02:23 -0000
(.NetXslTransform engine for xslt 1.0) 

Hi all,

Has anyone got any information on this?

The identity transform part of my xsl is transferring html <a> links from
the input to the output as follows:

Input: <a name="o1399"></a><h2 class="heading2">Licensing</h2>
Output: <a name="o1399" shape="rect"/><h2 class="heading2">Licensing</h2>


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml";
            exclude-result-prefixes="xhtml map">

<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" 
            indent="no" encoding="UTF-8" method="xml"/>

  <xsl:template match="node()">
      <xsl:apply-templates select="@*|node()"/>

  <xsl:template name="attribute" match="@*">

I tracked down the source of the shape="rect" to this line in the DTD:

  charset     %Charset;      #IMPLIED
  type        %ContentType;  #IMPLIED
  name        NMTOKEN        #IMPLIED
  href        %URI;          #IMPLIED
  hreflang    %LanguageCode; #IMPLIED
  rel         %LinkTypes;    #IMPLIED
  rev         %LinkTypes;    #IMPLIED
  shape       %Shape;        "rect"
  coords      %Coords;       #IMPLIED
  target      %FrameTarget;  #IMPLIED

- I don't want it, so if you can suggest how I can avoid it then good but,
my major problem, with these links (and similarly with <script /> elements
is that browsers do not like these 'self-closing' elements.

My solution for the script elements was to insert an <xsl:text> </xsl:text>
and thereby stretch them into a begin and end tag. You can see that I can't
do the same for the links because the space would appear (with blue
underline) in the output.

Any suggestions for forcing elements to use a start and end tag?

Thanks all,

Current Thread