Subject: Re: [xsl] Re:XPathAPI: How to associate namespaces From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 7 May 2003 12:27:49 +0100 |
but you'll run into this in case you start using an XHTML document written by any compliant XHTML editor as this will have exactly the characteristics I have described (default namespace, not prefixes). But it doesn't matter what prefix (or no prefix) the original document uses, You need to use a prefix in the Xpath. It doesn't have to be the same prefix as used in the document, what matters is the namespace name (ie the URI). > Is there any rule stating that a certain namespace URI (i.e. > http://www.w3.org/1999/xhtml has to use a specific prefix i.e. xhtml)? No, that's the whole point of the namespace system. Individual authors can use any prefix they want, so as to avoid conflicts with any other namespaces used in the document. > Are namespace URIs sort > of "free form" anyway or where can I find the rules how to for example > construct my own namespace. The _only_ property that a namespace has is its name (its URI). Apart from that all namespaces are identical, they just consist of teh countable set of strings that match the NCName production. So to construct your own namespace all you have to do is take any URI, eg mailto:TSchlabach@xxxxxxx and use it as a namepace: <x xmlns="mailto:TSchlabach@xxxxxxx"/> is the element with local name x and namespace mailto:TSchlabach@xxxxxxx > There should be a way to avoid conflicting prefixes, > shouldn't it? As I mentioned above, the whole point of using namespaces is to avoid conflicts. Anyone writing a document using the http://www.w3.org/1999/xhtml and the mailto:TSchlabach@xxxxxxx just needs to pick two different prefixes (one of which can be empty) and use one for each namespace, so there is no chance of collision within that document. (for elements at least you don't even need to use different prefixes if you don't want to, you can just switch the namespace bindings on each element with an explicit xmlns declaration. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re:XPathAPI: How to assoc, Torsten Schlabach | Thread | RE: [xsl] Re:XPathAPI: How to assoc, Michael Kay |
Re: [xsl] Re:XPathAPI: How to assoc, Torsten Schlabach | Date | RE: [xsl] Re:XPathAPI: How to assoc, Conal Tuohy |
Month |