Subject: namespaces (again)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 29 Apr 1999 13:09:47 +0100 (BST)
|
I wanted to be able to display more or less arbitrary XML `verbatim'
in an HTML pre element. (Mainly for demonstration purposes, to be
followed by the same input styled in a more conventional way.)
My best effort at this is http://andover.nag.co.uk/~davidc/verb.xsl
if anyone is interested. (Incidentally is there, or should there be,
a central archive for xsl sheets in the style of CTAN (Comprehensive
TeX Archive), or its younger perl cousin, CPAN ?)
A sample input and output shown below. It acts more or less as I want
except for the namespace support. The draft is fairly clear that the
namespace declaration attributes are not directly available.
I could presumably attach a namespace declaration to every element
with a non null namespace, but I'd rather like to move the declarations
up as far as possible up the result tree to prevent having to repeat.
I don't currently see if that's possible. Any ideas?
David
=====test.xml
<!DOCTYPE xyz [
<!ENTITY ent "hello">
]>
<xyz
xmlns:nspace="http://www.nag.co.uk/xxx">
<foo>
<nspace:bar x="22"/>
<a one="xxx" two="yyy">
<nspace:foo>
text
</nspace:foo>
</a>
<?px zzz ?>
<!--comment-->
<zzz/>
<qqq one="it's" two='"its"' three='"it's"' four='"x" and "y"'/>
</foo>
<bar/>
<text>
lt=<
gt=>
amp=&
quot="
quot="
ent=&ent;
</text>
</xyz>
=====test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<pre><xyz>
<foo>
<nspace:bar x="22"/>
<a one="xxx" two="yyy">
<nspace:foo>
text
</nspace:foo>
</a>
<?px zzz ?>
<!--comment-->
<zzz/>
<qqq one="it's" two="&quot;its&quot;" three="&quot;it's&quot;" four="&quot;x&quot; and &quot;y&quot;"/>
</foo>
<bar/>
<text>
lt=&lt;
gt=&gt;
amp=&amp;
quot="
quot="
ent=hello
</text>
</xyz></pre>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|