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

Re: elements in a namespace

Subject: Re: elements in a namespace
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Mon, 07 Jun 1999 01:24:26 +0100
francis norton
Mike,

This was very educational - thanks. You've corrected something I had not
only misunderstood but just posted to this newgroup as an answer...

Mike Brown wrote:
> 
> Steve Dahl was quite helpful. Here is a summary of what he told me in
> private email. Hopefully my interpretation is correct:
> 
> 1. Once a namespace is defined for an element, you must identify that
> element by the combination of its namespace prefix and the element name;
> simply referring to the element name by itself means "element with this name
> and with no namespace".
> 
> Example:
> If element <Department> contains <Employee> contains <FirstName>, and all
> are in the namespace assigned to prefix "mine", a variable could be bound to
> the value of the content of <FirstName> like this:
> 
> <xsl:variable name="Some_First_Name"
> expr="/mine:Department/mine:Employee/mine:FirstName"/>
> 
> 2. There's no way to define a default namespace to make the above any
> easier.

In the stylesheet, "Expression evaluation occurs with respect to a
context, which consists of: [...] the set of namespace declarations in
scope for the expression" but "the default namespace (as declared by
xmlns) is not part of this set"(see
http://www.w3.org/TR/1999/WD-xslt-19990421#expressions): in other words,
the spec says XSLT expressions can use namespace prefixes in the normal
way but not namespace defaults. So the example I just posted (using a
namespace default in the stylesheet) may work in XT but appears to be
incorrect.

> 
> 3. The binding of an element to a namespace doesn't affect its attributes.
> Attributes only need to be referenced with a prefix if they are specifically
> bound to a namespace themselves. Example:
> 
> <!-- attribute 'src' of element <img>, where <img>
>      is in namespace bound to prefix 'xhtml' -->
> <value-of select="xhtml:img/@src"/>
> 
> <!-- same, but with 'src' in namespace bound to prefix
>      'myAttributes' -->
> <value-of select="xhtml:img/@myAttributes:src"/>
> 
The namespaces rec says "Note that default namespaces do not apply
directly to attributes." So source attributes get processed in the same
way as XSLT expression attributes. Simpler...

Francis.
-- 
Francis Norton.

Air Rage - a "flight *and* fight" reaction?


 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.