Re: [xsl] How can I reindent an XML-file for readability?

Subject: Re: [xsl] How can I reindent an XML-file for readability?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 06 Jun 2001 11:39:10 +0100
At 11:35 AM 6/6/01, Janning wrote:
very strange to use a non xsl tool to transform an xml file.

Why so? People have been doing that for years (since before XML was XML).

Sorry Janning, I don't mean to pick on you. But personally I think the XSL "cause" is actually *harmed* by the (mis)perception that XSLT is supposed to be perfectly suited for all conceivable transformation tasks in XML. The very features that make it strong in some cases (say, the 80%), make it weak in others. And that's by design (read the spec).

It appears that yours is a perfect example of the latter, since you need to know which nodes come from which external parsed entity to get your indents to work right. And that isn't something the XSL processor knows directly. (It occurs to me that it does know it indirectly, via the Base URI property on each node. If you could get access to that information somehow, you might be able to do what you want in XSL. It would still be really ugly, though.)

The fundamental issue seems to be that on two sides (parsing and output formatting) the XSLT processing model assumes things will be "hands off" -- and you don't want them to be.

sometimes i think that external entities are less powerfull than it seems to

They can be powerful, but also tricky and problematic, which is why some old hands think they should be deprecated, presumably in favor of some linking syntax.

Good luck,

Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
  Mulberry Technologies: A Consultancy Specializing in SGML and XML

XSL-List info and archive:

Current Thread