On Mon, Feb 28, 2022 at 11:42 AM Nick Wellnhofer <wellnho...@aevum.de> wrote:
> On 28/02/2022 18:50, George Joseph via xslt wrote: > > I've been having a heck of a time trying to pass a parameter > > to xsltApplyStylesheet > > that has namespaces in the xpath expression. > > This use case is simply not supported. > Okaaaaay. > > > Finally I did find a workaround by calling xsltNewTransformContext() > then > > iterating > > over the nsDefs in the stylesheet document and > calling xmlXPathRegisterNs on > > ctxt->xpathCtxt for each nsDef. > > I'm a bit puzzled that this worked at all. See the code here: > > > > https://gitlab.gnome.org/GNOME/libxslt/-/blob/master/libxslt/variables.c#L1581 I think it works because xsltProcessUserParamInternal only sets xpctxt->namespaces = NULL but it doesn't clear xpctxt->nsHash which is where xmlXPathRegisterNs puts the namespaces to be registered. > > > But the expression is compiled before resetting the namespaces, so I guess > that's why. > > > I would have thought this would have been done automatically though. > Did I > > miss something or is there a better way to do this? > > No, I'd recommend that you only use string and integer params. > Can you give me a hint? I've had absolutely no luck is trying to pass a path as a string and getting it to result in something other than "The 'select' expression did not evaluate to a node set" even in an absurdly simple example. I'm passing the path double quoted "'/dm:device'" and have tried various combinations of "select=" and "with-param". Even Google is failing me so any help would be appreciated. Thanks! > > Nick >
_______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ xslt@gnome.org https://mail.gnome.org/mailman/listinfo/xslt