Re: Issues using parameters with namespaces

George Joseph via xslt <[email protected]> Mon, 28 Feb 2022 14:01:14 -0700
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <CAP=uFEuxqVL=Tu=22sqPmk=qeK-xKcBx0G4U8TKMt4XRLeO9LQ@mail.gmail.com>
--===============2004766820146779180==
Content-Type: multipart/alternative; boundary="0000000000004a3c3c05d91a5a61"

--0000000000004a3c3c05d91a5a61
Content-Type: text/plain; charset="UTF-8"

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

--0000000000004a3c3c05d91a5a61
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 1:04 PM Nick =
Wellnhofer &lt;<a href=3D"mailto:[email protected]">[email protected]</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-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>Is there any reason why path parameters with namespaces haven&#39;t =
been supported?</div><div>Would a pull request to add the namespaces in=C2=
=A0xsltNewTransformContext=C2=A0be considered?</div><div><br></div><div><br=
></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Nick<br>
<br>
</blockquote></div></div>

--0000000000004a3c3c05d91a5a61--

--===============2004766820146779180==
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

--===============2004766820146779180==--