RE: [xsl] short and long empty xml elements

Subject: RE: [xsl] short and long empty xml elements
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 13 Oct 2006 11:54:18 +0100
> a need to create a xml document that does not contain short 
> empty elements like <a/> but instead like this <a></a>. I 
> know this is the same, but the parser of the target system 
> does not recognize the first version. 

Bite the bullet. XML is a good thing because it's interoperable. If you have
a parser that isn't a conformant XML parser, throw it out and get a new one,
don't try to change the rest of the system to accommodate its weaknesses.

I use xalan or saxon. 
> Is there a way to control the kind of output in XSLT ? 

No, but at the Java level there are facilities in Saxon to customize the
serializer by subclassing the various components; you can register a
SerializerFactory that causes your own custom components to be used in place
of the standard ones.

Michael Kay

Current Thread