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

Re: namespace

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

here is an example with plain xml below;

<aaa xmlns="http://test.org/test>" xmlns:testprefix =
"http://test.org/anothertest">

<testprefix:bbb></testprefix:bbb>

</aaa>

defines the base namespace ( ie; no prefix ) as http://test.org/test, 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 http://www.exslt.org/str/functions/replace/index.html)

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:str="http://exslt.org/strings"
                xmlns:exsl="http://exslt.org/common"
                extension-element-prefixes="str exsl">

<xsl:template name="/">

</xsl:template>

</xsl:stylesheet>

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 http://www.dpawson.co.uk/xsl/sect4/N9723.html);
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:j="http://icl.com/java.util.Random"
  exclude-result-prefixes="j"
  version="1.0">

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

  <xsl:template match="/brands">

<html>
 <head>
 <title>Random</title>
 </head>
 <body>
  <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]" />
 </body>
</html>
</xsl:template>
</xsl:stylesheet>

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
(http://www.exslt.org/math/functions/asin/index.html) which illustrates this
function binding to microsoft javascript ( notice the xmlns:msxsl=
definition ).

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
 xmlns:math="http://exslt.org/math"
 extension-element-prefixes="math msxsl">

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

</xsl:stylesheet>


---------------------------------------------------------------

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
xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/


http://www.w3.org/TR/SOAP/
here is a soap FAQ
http://www.develop.com/soap/soapfaq.htm#28
some illustrating links
http://www.zvon.org/xxl/NamespaceTutorial/Output/index.html

http://www.dpawson.co.uk/xsl/sect2/N5536.html#d162e21

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:  namespace


> Hi,
>
> I've a very simple and basic question. What is actually a namespace that
we
> use in xml and soap - what is its role ?
>
> arsalan
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


 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.