Re: [xsl] Namespaces

Subject: Re: [xsl] Namespaces
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 10 Jun 2003 12:07:52 +0100
> Anyway, the dtd is here:

wherein we find:

<!ENTITY % ESJA.xmlns       "'http://www.elsevier.com/xml/ja/dtd'" >

<!ENTITY % top-level.att
               "xmlns           CDATA               #FIXED  %ESJA.xmlns;

which means that every element is in http://www.elsevier.com/xml/ja/dtd
(or at least i assume that applies to every element, I didn't actually
read much of the dtd)

Assuming that's right it means that a source element that looks like
<title>
is really
<title xmlns="http://www.elsevier.com/xml/ja/dtd";>
which means that a match of "title" or a select of /foo/bar/title
will not find it, as they are looking for no-namespace.
 you need on teh xsl:stylesheet element

xmlns:e="http://www.elsevier.com/xml/ja/dtd";

(or any other prefix that is free if e: is taken)

then have

match="e:title"
select="/e:foo/e:/bar/e:/title"
etc.

In XPath 1 you have to prefix any elements in a namespace.

Xpath/xslt2 drafts  allow you to say that the default namespace for
Xpath is "http://www.elsevier.com/xml/ja/dtd"; then your original would
work, but XSLT2 is not yet a done deal.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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


Current Thread