Re: [xslt] using key() function with key name in a variable
- From: Daniel Veillard <veillard redhat com>
- To: xslt gnome org
- Subject: Re: [xslt] using key() function with key name in a variable
- Date: Tue, 12 Nov 2002 13:31:16 -0500
On Tue, Nov 12, 2002 at 06:16:12PM +0000, Jre@scanlaser.nl wrote:
> gives the error
> runtime error: file gbs_log_show_all.xsl line 187 element variable
> key() : invalid arg expecting a string
> but
> key( string($k), ... )
> works ok.
Okay,
> I've tried the same thing in saxon, mozilla and msxml and they all seem to
> work when $k contains the RTF (without needing the string() function).
> Looking at the xslt rec, it doesn't seem to say much about the first
> parameter to key() other than that it's a string and a QName.
Hum,
> Didn't find anything in the archives and I don't remember seeing anything
> like this on xslt-list, so I don't know whether to report this as a bug or
> not, but it seems to act differently to several other xslt processors.
Seems very easy to fix to follow the common behaviour, so it's probably not
worth starting a standard reading contest over xsl-list :-)
Patch enclosed, untested since you didn't provided a full example.
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/
Index: libxslt/functions.c
===================================================================
RCS file: /cvs/gnome/libxslt/libxslt/functions.c,v
retrieving revision 1.42
diff -c -r1.42 functions.c
*** libxslt/functions.c 15 Oct 2002 16:06:47 -0000 1.42
--- libxslt/functions.c 12 Nov 2002 18:30:00 -0000
***************
*** 270,275 ****
--- 270,276 ----
return;
}
+ xmlXPathStringFunction(ctxt, 1);
obj2 = valuePop(ctxt);
if ((obj2 == NULL) ||
(ctxt->value == NULL) || (ctxt->value->type != XPATH_STRING)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]