[xsl] namespaces and copying trees

Subject: [xsl] namespaces and copying trees
From: Joern Clausen <joern@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 8 Aug 2001 18:01:00 +0200
Hi!

Suppose, I have an XHTML document with some additional metadata, seperated
from the HTML by it's own namespace:


<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:foo="foonamespace">

  <foo:metadata>
     <foo:author>Joe User</foo:author>
     <foo:date>2001-08-07</foo:date>
  </foo:metadata>

  <head>
     ....
  </head>
  <body>
     ...
  </body>
</html>


Now I want (among other things) to generate an HTML version of this
file, without the metadata. How can I exclude everything in the "foo"
namespace?

For this specific case, this works (with the appropriate namespaces
declared in the stylesheet, of course):

  <xsl:template match="xhtml:html">
    <html>
      <xsl:copy-of select="xhtml:head"/>
      <xsl:copy-of select="xhtml:body"/>
    </html>
  </xsl:template>

But what if I want to allow metadata to appear at arbitrary places in
the XHTML document? I think there must be a more elegant way to say
"Take everything from this namespace, forget everything from all other
namespaces."


Thanks in advance,
   Joern

-- 
 Joern Clausen                                joern@xxxxxxxxxxxxxxxxxxxxxxxx
 Faculty of Technology           http://www.TechFak.Uni-Bielefeld.DE/~joern/
 Bielefeld University, Germany                           +49 (0)521/106-2905

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


Current Thread