Re: Issues using parameters with namespaces

George Joseph via xslt <[email protected]> Mon, 28 Feb 2022 14:07:35 -0700
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <CAP=uFEs5i8hhcD-CQ2sr_peH=8YAjhoYh_kLXmJQ3g2UM6NLMA@mail.gmail.com>
--===============8573201933322494617==
Content-Type: multipart/alternative; boundary="000000000000020bb105d91a71f7"

--000000000000020bb105d91a71f7
Content-Type: text/plain; charset="UTF-8"

On Mon, Feb 28, 2022 at 2:01 PM George Joseph <[email protected]> wrote:

>
>
> On Mon, Feb 28, 2022 at 1:04 PM Nick Wellnhofer <[email protected]>
> 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
>>
>>

--000000000000020bb105d91a71f7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 28, 2022 at 2:01 PM Georg=
e Joseph &lt;<a href=3D"mailto:[email protected]">[email protected]</a>=
&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div=
 dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote"><div=
 dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 28, 2022 at 1:04 PM Nick Well=
nhofer &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">wellnho=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin=
g-left:1ex">On 28/02/2022 20:54, George Joseph via xslt wrote:<br>
&gt;=C2=A0 =C2=A0I think it works because=C2=A0xsltProcessUserParamInternal=
 only sets<br>
&gt; xpctxt-&gt;namespaces =3D NULL but it doesn&#39;t clear xpctxt-&gt;nsH=
ash which is where<br>
&gt; xmlXPathRegisterNs puts the namespaces to be registered.<br>
<br>
Right, the XPath engine uses both -&gt;namespaces and -&gt;nsHash.<br>
<br>
&gt; Can you give me a hint?=C2=A0 =C2=A0I&#39;ve had absolutely no luck is=
 trying to pass a path<br>
&gt; as a string and getting it to result in something other than &quot;The=
 &#39;select&#39; <br>
&gt; expression<br>
&gt; did not evaluate to a node set&quot; even in an absurdly=C2=A0simple e=
xample.=C2=A0 I&#39;m passing<br>
&gt; the path double quoted &quot;&#39;/dm:device&#39;&quot; and have tried=
 various combinations of<br>
&gt; &quot;select=3D&quot; and &quot;with-param&quot;.=C2=A0 =C2=A0 Even Go=
ogle is failing me so any help would be <br>
&gt; appreciated.<br>
<br>
I meant that you should only use string or integer literals in parameter <b=
r>
values and no other XPath expressions at all. This means to rework your <br=
>
stylesheets, of course.<br></blockquote><div><br></div><div>I think I&#39;l=
l stick with my solution to add the namespaces to the xpath context. :)</di=
v></div></div></blockquote><div><br></div><div>Actually=C2=A0&quot;//*[name=
()=3D&#39;dm:device&#39;]&quot; works as well so maybe that&#39;s what I&#3=
9;ll do.</div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>Is th=
ere any reason why path parameters with namespaces haven&#39;t been support=
ed?</div><div>Would a pull request to add the namespaces in=C2=A0xsltNewTra=
nsformContext=C2=A0be considered?</div><div><br></div><div><br></div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Nick<br>
<br>
</blockquote></div></div>
</blockquote></div></div>

--000000000000020bb105d91a71f7--

--===============8573201933322494617==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
https://mail.gnome.org/mailman/listinfo/xslt

--===============8573201933322494617==--