Re: [xslt] Issues using parameters with namespaces



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.

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

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.

Nick


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