Re: [xslt] libxslt bug? stripping namespace prefix in element output.



On Mon, Mar 31, 2003 at 04:48:17PM -0800, Shawn O. McKenzie wrote:
> Howdee.
> 
> I have been beating my head against a problem and am wondering if it is 
> a bug. I am having problems outputing elements in an html file that have 
> a different namespace prefix. Something like <MSHelp:Keyword Index="K" 
> Term="foo"/>
[...]
> 
> I get an output of:
> 
> <html>
> <whatever>one</whatever><whatever>two</whatever><whatever>three</whatever><whatever>four</whatever>
> </html>
> 
> So, it seems to be stripping the foo: prefix off the foo:whatever 
> element. Does this using both xsltproc and Python. Seems to work fine on 
> Microsoft's processor and on Saxon.

   As pointed by http://xmlsoft.org/XSLT/bugs.html the first thing to
do is to check with a recent version. Since you don't indicate it I'm 
pretty sure it's just that you're using an older one, this has been fixed
a few releases ago in libxml2. So upgrade !

paphio:~/tmp -> xsltproc tst.xsl tst.xml
<html xmlns:foo="http://borland.com/bogus";>
<foo:whatever xmlns:foo="http://borland.com/bogus";>one</foo:whatever><foo:whatever xmlns:foo="http://borland.com/bogus";>two</foo:whatever><foo:whatever xmlns:foo="http://borland.com/bogus";>three</foo:whatever><foo:whatever xmlns:foo="http://borland.com/bogus";>four</foo:whatever>
</html>
paphio:~/tmp ->

   But your report was useful anyway, as you can see there was a bug in the
namespace handling resulting in repeated xmlns:foo declarations. I fixed it
in CVS and added it to the regression tests:

paphio:~/tmp -> xsltproc tst.xsl tst.xml
<html xmlns:foo="http://borland.com/bogus";>
<foo:whatever>one</foo:whatever><foo:whatever>two</foo:whatever><foo:whatever>three</foo:whatever><foo:whatever>four</foo:whatever>
</html>
paphio:~/tmp ->

   This looks better,

     thanks,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]