RE: [xsl] Creating nested output from <xsl:if>'s

Subject: RE: [xsl] Creating nested output from <xsl:if>'s
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sat, 4 Dec 2004 16:26:28 -0000
> I was using <xsl:text> because it seemed to give for better 
> formatting using 
> xsltproc. Is there a better way?
> This method works fine. Thanks

If you're taking responsibility for serializing the XML then you've got your
work cut out. In particular you need to make sure that all special
characters such as < and & (and quotes within attributes) are properly
escaped. You also have to get all the namespaces right. It's far better to
leave this job to the XSLT processor.

There's another reason for this, which is that your code becomes more
reusable. Once you've serialized the output, you can't do anything further
with it except by re-parsing it.

If you need more control over formatting than xsl:output gives you, then I
worry about the design of the applications that are consuming this XML.

Michael Kay
http://www.saxonica.com/

Current Thread