RE: [xsl] A very basic question.

Subject: RE: [xsl] A very basic question.
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Mon, 24 Feb 2003 08:30:55 -0700
> From: Simon Kelly [mailto:kelly@xxxxxxxxxx]
> Sent: Monday, February 24, 2003 7:54 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] A very basic question.
> 
> I've not been using xsl and xml for that long, but I can do 
> pretty much what
> I need with what I already know.  But I have never really 
> understood what a
> name-space is really refering too.

A namespace refers to a collection of names, or XML elements, bound to a
given name.  A very basic example is XSLT itself: its elements (stylesheet,
template, variable, etc.) are bound to the 'xsl' namespace.  In order for
the XML parser to recognize that a set of elements belong to a namespace, an
XML namespace declaration must be used:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

The value of xmlns:xx must be a globally unique Uniform Resource Identifier
(URI); this is often a URL, but can be any unique string.  (In the case of
XSLT, it should always be the above-referenced URL.)  Any elements belonging
to a declared namespace must be prefixed by the namespace name, so that
<xsl:stylesheet> has special meaning to an XSLT processor, but <stylesheet>
(note no prefix) does not.

This also allows you to use your own namespaces in an XML document, as long
as the URI you use is unique:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0"
                xmlns:myxml="http://my.own.xmlnames.org";>
  <myxml:some-element>foo</myxml:some-element>
  etc.
</xsl:stylesheet>

There is a lot more information (surely better explained than what I've
written) in the XSLT FAQ at http://www.dpawson.co.uk/xsl/sect2/N5536.html.

hth,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread