Subject: Re: [xsl] namespace From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Fri, 21 Jun 2002 16:05:10 +0100 |
Hi Nick, > When i run my stylesheet I have been getting a namespace error for > <ref:SECTION GIDR="t_28_part_0_00004"/>. > It says the namespace ref is not declared. in my attemps to fix > this, the only way i could get it to work was by adding > xmlns:ref="http://nothing to the <SUBPART GID="t_28_part_0_00003" > PARENT-GIDR="t_28_part_0" CHRCNT="6930"> in the xml file. XSLT cannot operate on any old XML files. As well as being well formed, the XML files have to adhere to the XML Namespaces Recommendation. What that means is that you can't use colons in element and attribute names willy-nilly -- you can only use them if you're using them to separate a prefix from a local part of an element or attribute name. And the prefix has to be declared with a namespace declaration. If the XML files that you're working with *don't* adhere to the XML Namespace Recommendation then you can't use XSLT with them. The best thing that you can do is either add the namespace declaration to the files (preferably with a meaningful namespace name) or stop using colons in the element names (perhaps replace ref:SECTION with ref.SECTION instead). You could get round editing the existing files by generating XML documents that use entities to pull in the existing files, something like: <!DOCTYPE wrapper [ <!ENTITY file SYSTEM 'file.xml'> ]> <wrapper xmlns:ref="http://www.example.com/"> &file; </wrapper> but creating one of these for each of your files is likely to be just as much trouble as editing the files you have. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] namespace, David Carlisle | Thread | [xsl] Preventing Bounced Messages o, Mulberry Technologie |
Re: [xsl] namespace, David Carlisle | Date | [xsl] Preventing Bounced Messages o, Mulberry Technologie |
Month |