This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Regarding Default Namespaces
- To: <XSL-List at lists dot mulberrytech dot com>
- Subject: Re: [xsl] Regarding Default Namespaces
- From: "Thomas B. Passin" <tpassin at mitretek dot org>
- Date: Tue, 9 Oct 2001 10:43:16 -0400
- References: <00ef01c150c3$d612b6c0$ae06a8c0@intranet.pspl.co.in>
- Reply-To: xsl-list at lists dot mulberrytech dot com
[Avani Goel]
> Conside this XMl:
>
> <?xml version='1.0'?>
> <?sheet type="text/xml" href="14-2.xsl"?>
> <apples xmlns="www.apple.com">
>
> <apple> no prefix</apple>
>
> <fruits:apple xmlns:fruits='http://www.fruits.com'>
> A FRUIT
> <fruits:fig fruits:id="1">
> A FIG
> </fruits:fig>
> <bbb>bbb</bbb>
> </fruits:apple>
>
> </apples>
>
[...]
>
> Please tell me how to access an elment whose URI is a default namespace.
>
You cannot access it directly. What you have to do is to declare that
namespace in the stylesheet but give it a prefix, like "ap". In your
templates, when you want the "unprefixed" apple element, you call it
"ap:apple". In other words, the unprefixed elements in the xml file are in
fact in a namespace. You just have to make that namespace explicit in the
stylesheet.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list