Re: [xslt] Problems with embedded stylesheets, in particular with namespaces



On Tue, Sep 09, 2008 at 09:24:20PM +0100, Martin (gzlist) wrote:
> On 09/08/2008, Martin (gzlist) <gzlist googlemail com> wrote:
> > Documents with embedded stylesheets may fail to transform with libxslt
> >  when they reference namespaces from their surrounding scope...
> 
> Daniel or William, can one of you spare some time to look at this
> issue? It makes single-file XSLT testcases that work in Internet
> Explorer, Mozilla based browsers, and Opera, useless for WebKit
> derived programs, due to their reliance on libxslt.
> 
> I had a chance to look at the code more today, and decided the idea I
> had shortly after the original post, of copying the sub-tree then
> walking up the parents and adding missing namespaces, would work. The
> method is simple but not efficient (xmlNewNs speculatively allocates
> before doing the check to see if the prefix already exists, for
> instance) however this is deeply unlikely to be on any performance
> critical path. Included with these changes (attached,

  Right, any embedded stylesheet is also likely to be very small,
I really don't see that as a problem !

> embedded_transform.patch) is the addition of setting the base URI of
> the stylesheet, required for expressions containing relative links to
> external resources.
> 
> Also have ten or so stylesheet documents that I'll work into the test
> suite if this patch is deemed the right option.

  Send them if you still have them around !

> In the process of writing this, I found and fixed (attached,
> qname_issues.patch) a couple of analogous issues to the QName problems
> in libxml2 that I came across recently.

  Yup, good catch, I applied it to git first

The main patch looks fine too, it does what I would expect in that
situation, I think the dictionary should be copied on the new document
for consistency even if the subtree is reallocated, at some point maybe
our doc copying will get smarter and allocate names on the target doc
dictionary if provided.
So I think this is all good, passes tests and valgrind, applied and
commited to git, I also added the 2 tests in tests/REC where they are
checked for transformations with and ithout dictionnary sharing.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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