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

Self-closing elements upset some browsers

Subject: Self-closing elements upset some browsers
From: "Marroc" <marrocdanderfluff@xxxxxxxxxxx>
Date: Fri, 14 Mar 2008 12:48:24 -0000
 Self-closing elements upset some browsers
I sent this yesterday but haven't seen this appear on the list - I apologize
for repeats but I really would like to resolve this elegantly. R

(.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>

Transform:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
	      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
		xmlns:xhtml="http://www.w3.org/1999/xhtml" 
		xmlns:map="local" 
		xmlns:msxsl="urn:schemas-microsoft-com:xslt"
            exclude-result-prefixes="xhtml map">

<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" 
 
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" 
            indent="no" encoding="UTF-8" method="xml"/>

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

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

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

<!ATTLIST a
  %attrs;
  %focus;
  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 empty elements to use a start and end tag?

Thanks all,
Richard

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.