This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Regarding Default Namespaces


[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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]