namespaces (again)

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&apos;s"' four='"x&quot; and "y"'/>
</foo>
<bar/>
  <text>
    lt=&lt;
    gt=&gt;
    amp=&amp;
    quot="
    quot=&quot;
    ent=&ent;
  </text>
</xyz>


=====test.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<pre>&lt;xyz&gt;
&lt;foo&gt;
  &lt;nspace:bar x="22"/&gt;
  &lt;a one="xxx" two="yyy"&gt;
    &lt;nspace:foo&gt;
     text
    &lt;/nspace:foo&gt;
  &lt;/a&gt;
  &lt;?px zzz ?&gt;
  &lt;!--comment--&gt;
  &lt;zzz/&gt;
  &lt;qqq one="it's" two="&amp;quot;its&amp;quot;" three="&amp;quot;it's&amp;quot;" four="&amp;quot;x&amp;quot; and &amp;quot;y&amp;quot;"/&gt;
&lt;/foo&gt;
&lt;bar/&gt;
  &lt;text&gt;
    lt=&amp;lt;
    gt=&amp;gt;
    amp=&amp;amp;
    quot="
    quot="
    ent=hello
  &lt;/text&gt;
&lt;/xyz&gt;</pre>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread