Re: [xslt] UTF-8 escaping

On Mon, Aug 19, 2002 at 05:47:27PM +0200, Wesley W. Terpstra wrote:
> On Mon, Aug 19, 2002 at 10:28:11AM -0400, Daniel Veillard wrote:
> Cool. I did not see this escaping algorithm when I went looking.
> What is the method to call this function from xpath? I don't see a
> .*Register.* in the file. Also:
> terpstra@maul:~/apt/libxml2-2.4.23$ grep URI *.c | grep Register
> -> nada

  in include/libxml/xpathInternals.h

> re: erroneous escaping:
> This is not the point of escape-uri as the w3c recommendation considers it.

<pedantic>this is not a Recommendation, XQuery is a Working Draft
and at the moment I would say that IETF rules the URI infrastructure
not W3C, the RFCs are far more normative in this respect :-)</pedantic>

> It is not intended to _guess_ what the URI it is escaping is (relative,
> absolute, fragment, etc)---the caller tells it what he wants escaped, and
> then gets back the string. There is no magic detection by design.

  Well, hum, okay, I read too fast then, my mistake :-)

> > > +     xmlXPathRegisterFunc(ctxt, (const xmlChar *)"escape-uri",
> > > +                          xmlXPathEscapeUriFunction);
> > 
> >   2/ registering this extension function directly in the XPath library
> >      without an URI associated to the extension is plain wrong and would
> >      make libxml2 XPath implementation non-conformant. The extension fonction
> >      would have to be registered for example as an EXSLT funtion or under
> >      another specific namespace, but definitely not without prefix.
> The function I implemented *will probably be* part of XPath.
> It is listed for xpath 2.0:

  Hum, I don't claim  to get XPath 2.0 compliance, and even the 
XQuery draft suggest to have it registered in their function namespace

> I just thought it would be nicer to use the new function in XPath 2 than to
> create yet another engine-specific extension.

  Well if you put it directly in the XPath core while it's not standardized
then you make it an engine-specific extension, precisely :-)
  Maybe XQuery extensions could be added to libxml2 but then I would really
require them to be listed as XPath extensions anyway, seems to me it would
fit your needs, right ?

> PS. Is there any existing way in libxslt to do:
> 	str->utf-8->hex
> and get the answer back inside xsl?

  libxslt only manipulates strings in UTF8 internally, so the first step
is somewhat trivial but the second part might be more challenging, I don't
think there is an ad-hoc XSLT entry point for this, maybe EXSLT or this could
be done on pure XSLT ...


Daniel Veillard      | Red Hat Network  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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