W3C home > Mailing lists > Public > www-archive@w3.org > July 2003

Re: xslt idea: namespace-coloured XML prettyprinter?

From: Dan Brickley <danbri@w3.org>
Date: Mon, 7 Jul 2003 18:44:37 -0400
To: Max Froumentin <mf@w3.org>
Cc: www-archive@w3.org, libby.miller@bris.ac.uk
Message-ID: <20030707224437.GC29777@tux.w3.org>

I was just trying this with the online w3c xslt service, output is:

...it seems to perform the right kind of translation, but the resulting markup
doesn't show as styled html in any of my browsers. Any idea what's going wrong?
Your RSS example looks fine btw in all the browsers, and the markup appears 
superficialyl to be bhthe same....


* Max Froumentin <mf@w3.org> [2003-02-25 11:17+0100]
> Dan Brickley <danbri@w3.org> wrote:
> > Would it be possible to implement the following using XSLT?
> You know I can't resist a challenge. ;) 
> Jump to bottom for a solution that almost does it. Read on to know
> why almost.
> Writing an XML serialiser in pure XSLT is almost possible.  You can
> get most of what you want, with a few exceptions like namespace
> declarations, since the XPath data model doesn't store them. Instead
> it stores with every element a list of all the namespace URIs that are
> in scope on this element. You could serialise those, but it means you
> have namespace declarations on every single element. So the example
> stylesheet below doesn't produce them at all (and you may have noticed
> that mozilla 1.3 doesn't either, when it displays XML. This may be
> because they use XSLT to do it, just like IE, except that IE cheats
> and uses XSLT extensions to find the original namespace decls).
> There's a way around that, but you have to implement the "namespace
> fixup" algorithm to factor out the redundant declarations. Not
> impossible, but even that doesn't ensure you get the original
> namespace declarations, only the less redundant way to declare them.
> Another thing that you are not certain to get in the output (although
> most processors do it right) are the namespace prefixes, since they are
> not stored in the xpath data model either, and a processor could just
> make them up as it outputs the node names.
> Bar those, I think you can pretty much get what you want. Look at 
> http://www.w3.org/2003/02/colour-xml-serializer.xsl
> http://www.w3.org/2003/02/rssexample.html
> Cheers,
> Max.
Received on Monday, 7 July 2003 18:44:41 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:42:26 UTC