On Sun, 2004-02-15 at 09:32, Christian Kreutz wrote: > Hello list, > > I have a problem with xpointer and xmlns="http://www.w3.org/1999/xhtml" > namespace. > I want to include parts of a xhtml document (title) in another xml file, but > it doesn't get the content of the node <title> using xinclude in either > article1 or article2. In case of article3 it works but only for the whole file. > :-) But when I delete the namespace xmlns="http://www.w3.org/1999/xhtml out > of > index.xml I get an outcome from the article2 xinclude. > > Any ideas? Thanks for any help. > > The file to where parts of index.xml should be included: > > <?xml version="1.0" encoding="utf-8" ?> > <news xmlns:xi="http://www.w3.org/2001/XInclude"> > <article1> > <xi:include > href="article1/index.xml#xmlns(ert=http://www.w3.org/1999/xhtml)#xpointer(//ert:title)" > />
First of all, you got a "#" too many in there, it should read: href="article1/index.xml#xmlns(ert=http://www.w3.org/1999/xhtml)xpointer(//ert:title)" error reporting on this was pretty lame (you got a blank page), I've made some fixes for this which I'll check in in a moment. But then it still won't work. To try it out I simplified your document down to this: <?xml version="1.0" encoding="UTF-8"?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Title to be included with xpointer</title> </head> </html> and tried the following includes: <xi:include href="article1/index.xml#xmlns(ert=http://www.w3.org/1999/xhtml)xpointer(//ert:title)" /> <xi:include href="article1/index.xml#xmlns(my=http://www.w3.org/1999/xhtml)xpointer(/my:html/my:head/my:title)"/> which don't work. Interestingly enough, if you change both the XML file and the xpointer expressions by renaming html to x, head to y and title to z (while leaving them in the same namespace), it will work. Here are the snippets: <?xml version="1.0" encoding="UTF-8"?> <x xmlns="http://www.w3.org/1999/xhtml"> <y> <z>Title to be included with xpointer</z> </y> </x> and <xi:include href="article1/index.xml#xmlns(ert=http://www.w3.org/1999/xhtml)xpointer(//ert:z)" /> <xi:include href="article1/index.xml#xmlns(my=http://www.w3.org/1999/xhtml)xpointer(/my:x/my:y/my:z)"/> Also interesting, is that when changing the document to use explicit namespaces, it also works: <?xml version="1.0" encoding="UTF-8"?> <x:html xmlns:x="http://www.w3.org/1999/xhtml"> <x:head> <x:title>Title to be included with xpointer</x:title> </x:head> </x:html> I've also tried changing the XPath processor implementation from xalan to jaxen but that didn't make a difference. The only thing I could still think of then is that the DOMBuilder does something special with plain HTML elements, but I wouldn't know what and didn't immediately notice something. Needs further investigation... (for which I don't have time right now) -- Bruno Dumon http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center [EMAIL PROTECTED] [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
