• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Namespaces

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have started working on a project with XML/XSLT and am really confused about the list of namespaces in the xml docs and the xsl stylesheets. What do declarations like
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns sw="http://xml.orbital.co.uk/organik/ui-data"
xmlns:customisation="xalan://com.orbitalsw.customisation.stdclient.XalanClient"
extension-element-prefixes="customisation">
these mean? Can anybody explain the basics of the namespaces to me?
Thanks
Sunetra
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

While I am not sure I can do a good job explaining
NameSpaces, I would suggest this FAQ which maybe
helpful...http://www.rpbourret.com/xml/NamespacesFAQ.htm
Trust me I have some trouble understanding it myself.
regds.
- satya
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The text Madhav pointed to has the best known for today explanations on namespaces in general. However, in your case there is some specifics.
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
here you tell the XSLT processor that all element with xsl prefix are XSLT elements and shold be dealt as such, i.e. executed
xmlns:osw="http://xml.orbital.co.uk/organik/ui-data"
Your XSLT probably has some elements with osw prefix. These will be copied into output as is, but you have to declare prefix to make XSLT processor happy.
xmlns:customisation="xalan://com.orbitalsw.customisation.stdclient.XalanClient" extension-element-prefixes="customisation">
here you declare prefix for so-called extension elements: they are not standard XSLT elements, but elements supported by certain XSLT processor (Xalan in your case). They will be executed like "normal" XSLT elements, but if you run your stylesheet with another XSLT processor, most likely they will not work.
[This message has been edited by Mapraputa Is (edited August 08, 2001).]
 
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I am myself new in XML. But whatever I have understood from Namespaces I `ll try to tell in lucid language.
When you use , say in xsl, tags like <xsl:value-of select..>.
How is it known first of all that there does exist a tag like value-of, (associated with xsl) and if does, what should be interpreted by it, i.e what is it supposed to do???
Herein comes the Namespaces.
When you write:

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...

It means that the tag belongs to xsl and what is to be interpreted from it is given at :
http://www.w3.org/1999/XSL/Transform"...
and so on
I would request the experts to please enhance our knowledge by adding their comments \ correction to this.
Thanks,
Regards,
 
Sunetra Saha
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, all of you. Will go thru the FAQ suggested by Madhav.
 
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Namespaces are a simple and straightforward way to distinguish names used in XML documents, no matter where they come from.
Here's a tiny sample of what we might do:

In this example, the elements prefixed with xdc are associated with a namespace whose name is http://www.xml.com/books, while those prefixed with h are associated with a namespace whose name is http://www.w3.org/HTML/1998/html4.
The prefixes are linked to the full names using the attributes on the top element whose names begin. xmlns:. The prefixes don't mean anything at all - they are just shorthand placeholders for the full names. Those full names, you will have noticed, are URLs, i.e. Web addresses.
One of the confusing things about all this is that namespace names are URLs; it's easy to assume that since they're Web addresses, they must be the address of something. They're not; these are URLs, but the namespace draft doesn't care what (if anything) they point at. Think about the example of the XML.com programmer looking for book titles; that works fine without the namespace name pointing at anything.
The reason that the W3C decided to use URLs as namespace names is that they contain domain names (e.g. www.xml.com), which work globally across the Internet.
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check the following URL for the myths about namespaces
http://www.xml.com/pub/a/2000/03/08/namespaces/index.html?page=1
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!