Re: [xslt] Issues using parameters with namespaces





On Mon, Feb 28, 2022 at 2:01 PM George Joseph <gjoseph sangoma com> wrote:


On Mon, Feb 28, 2022 at 1:04 PM Nick Wellnhofer <wellnhofer aevum de> wrote:
On 28/02/2022 20:54, George Joseph via xslt wrote:
>   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.

Right, the XPath engine uses both ->namespaces and ->nsHash.

> 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.

I meant that you should only use string or integer literals in parameter
values and no other XPath expressions at all. This means to rework your
stylesheets, of course.

I think I'll stick with my solution to add the namespaces to the xpath context. :)

Actually "//*[name()='dm:device']" works as well so maybe that's what I'll do.

 
Is there any reason why path parameters with namespaces haven't been supported?
Would a pull request to add the namespaces in xsltNewTransformContext be considered?


 

Nick



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