Re: [xsl] namespace

Subject: Re: [xsl] namespace
From: "cutlass" <cutlass@xxxxxxxxxxx>
Date: Tue, 24 Jul 2001 10:06:16 +0100
in their simplest incarnation namespaces allow mixing of xml vocabularies,
since XSLT is itself an xml vocabulary with its own namespace (xsl: is the

here is an example with plain xml below;

<aaa xmlns=">" xmlns:testprefix =



defines the base namespace ( ie; no prefix ) as, the
xmlns:testprefix defines another namespace, so we have mixing, why is this
useful ?

lets look at a more complicated cutdown xslt example ( u can see the whole
template at

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                extension-element-prefixes="str exsl">

<xsl:template name="/">



with this the namespace with the prefix xsl: is our XSLT namespace
the others are namespaces used with the exslt effort.

namespaces are an efficient method for mixing vocabularies, ie i could
extract the value of elements with only a specific namespace.

namespaces are also used for binding functionality,

for example ( taken from;
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="";

<xsl:output method="html" indent="yes"/>

  <xsl:template match="/brands">

  <xsl:variable name="cars" select="count(car)"/>
  There are <xsl:value-of select="$cars" /> car brands in the list.<br />
  <br />
  <xsl:variable name="R" select="j:new()" />
  <xsl:variable name="r" select="ceiling(count(car) * j:nextDouble($R))" />
  Selected car brand is: <xsl:value-of select="car[$r]" />

this namespace generates a random number by using, this isnt done by magic,
the parser ( in this case using a java function ) has to be able to get to
the java function.

here is another example
( which illustrates this
function binding to microsoft javascript ( notice the xmlns:msxsl=
definition ).

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
 extension-element-prefixes="math msxsl">

<msxsl:script language="JavaScript" implements-prefix="math">
function asin(arg){ return Math.asin(arg);}



to answer your question there is no default namespace with xml, except those
that you define.

here is the SOAP spec, you will notice that there are a few SOAP namespaces,
though if i had to give an answer here it is
here is a soap FAQ
some illustrating links

cheers, jim fuller

----- Original Message -----
From: "Lodhi, arsalan" <arsal01@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Cc: <arsal01@xxxxxxxxxxx>
Sent: Tuesday, July 24, 2001 6:12 AM
Subject: [xsl] namespace

> Hi,
> I've a very simple and basic question. What is actually a namespace that
> use in xml and soap - what is its role ?
> arsalan
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread