[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Different Namespace Prefixes for Same Namespace UR

Subject: Re: Different Namespace Prefixes for Same Namespace URI
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 3 Mar 2003 20:29:59 +0100
same namespace different prefix
> Normally I could get the value
> of the <widget> element from this document:
>
>   <content xmlns:foo="http://example.org/ns">
>     <foo:widget>test</foo:widget>
>   </content>
>
> with
>
>   <xsl:value-of select="/content/foo:widget"/>
>
> But what happens if the namespace prefix isn't
> "foo", but "bar" as in this document:
>
>   <content xmlns:bar="http://example.org/ns">
>     <bar:widget>test</bar:widget>
>   </content>
>
> Can the namespace be referenced via the URI in
> some manner, or is there another standard approach
> to dealing with this issue?

You don't need to reference the element via another prefix.

If you have in your stylesheet bound the prefix "foo" to the namespace-uri
"http://example.org/ns"

Then

  <xsl:value-of select="/content/foo:widget"/>

will correctly produce the string value of bar:widget

This is because the (real) extended name of an element is composed of these
two parts: its namespace-uri and its local-name. The prefix used doesn't
matter -- it's role is just to serve as an abbreviation for the
namespace-uri.


Hope this helped.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL





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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.