RE: elements in a namespace

Subject: RE: elements in a namespace
From: Mike Brown <mbrown@xxxxxxxxxxxxx>
Date: Sun, 6 Jun 1999 15:08:08 -0600
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.

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"/>



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


Current Thread