Re: xslt idea: namespace-coloured XML prettyprinter?

I was just trying this with the online w3c xslt service, output is:
http://www.w3.org/2000/06/webdata/xslt?xslfile=http://www.w3.org/2003/02/colour-xml-serializer.xsl&xmlfile=http://rdfweb.org/people/danbri/rdfweb/danbri-foaf.rdf

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

dan


* 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