Re: List of stylesheet parameters?

Dimitre Novatchev <[email protected]> Thu, 18 Nov 2021 13:31:50 -0800
Newsgroups gmane.text.xml.saxon.help
Message-ID <CAK4KnZcGU0FL+cfNEv6P8iuiQ-zyM0qKpLRGnT4pqMLRUzhvMQ@mail.gmail.com>
--===============8775340252230365677==
Content-Type: multipart/alternative; boundary="0000000000009852c505d116e3bd"

--0000000000009852c505d116e3bd
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Nov 18, 2021 at 11:34 AM Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]> wrote:

> It's not possible to provide run-time access to ALL variables, because
> many variables (both local and global) are eliminated or rewritten at
> compile time. For example a variable has no detectable existence at
> run-time if it was found to be unused, or if it was inlined, or if it was
> replaced by a different variable (for example replacing a variable bound =
to
> @price with one that's bound to data(@price)).
>
> You'll see this if you look at a Saxon stack-trace after a dynamic error =
-
> it shows the variables that exist at run-time, which may exclude some tha=
t
> existed at compile time, and also include others that were generated by t=
he
> compiler.
>
>
Still, providing data about the known variables is valuable in a range of
use-cases as this one.
This could be considered "debugging" or "detecting unexpected errors".

Thanks,
Dimitre


> Michael Kay
> Saxonica
>
>
>
> On 18 Nov 2021, at 15:25, Dimitre Novatchev <[email protected]> wrote:
>
> In July I asked this on the XML.com Slack #xpath-ng channel (and your
> question is exactly one use-case for this proposal):
>
> https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200
>
> Dimitre Novatchev <https://app.slack.com/team/U01F9LEC4SE>  6:26 PM
> <https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200>
> Question: AFAIK we don't have an XPath function that returns all
> variables/parameters  that are in context, do we?
> Please, correct me if I am wrong.Having such a function will be useful
> for debugging and other goals. Any thoughts?
>
> There was a thread on this with 27 responses, most positive, the question
> got 7 thumbs-up, but I am not aware of anything been done further.
>
> Probably must add this as an official proposal on
> https://github.com/qt4cg/qtspecs/issues
>
>
> Thanks,
> Dimitre
>
> On Wed, Nov 17, 2021 at 11:16 AM Graydon Saunders <[email protected]>
> wrote:
>
>> Hello!
>>
>> I am pretty sure there isn't a way to do this, but maybe I'm wrong.
>>
>> In current Saxon -- 10.* -- using XSLT 3.0, is there some way to get a
>> list of the stylesheet parameters?
>>
>> The intent is to then check that they all have values assigned, since on=
e
>> of the ways the "call this stylesheet" step of the processing chain fail=
s
>> is "oops, that needs a value".  There's an extension function,
>> saxon:tunnel-params(), that would be just the thing if it were
>> saxon:in-scope-params().
>>
>> (If not, an explicit list of parameters will work.  I am hoping for a
>> more elegant solution.)
>>
>> Thanks!
>>
>> ---
>> Graydon Saunders  | [email protected]
>> =C3=9E=C3=A6s ofer=C3=A9ode, =C3=B0isses sw=C3=A1 m=C3=A6g.
>> -- Deor  ("That passed, so may this.")
>> _______________________________________________
>> saxon-help mailing list archived at http://saxon.markmail.org/
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> Truly great madness cannot be achieved without significant intelligence.
> ---------------------------------------
> To invent, you need a good imagination and a pile of junk
> -------------------------------------
> Never fight an inanimate object
> -------------------------------------
> To avoid situations in which you might make mistakes may be the
> biggest mistake of all
> ------------------------------------
> Quality means doing it right when no one is looking.
> -------------------------------------
> You've achieved success in your field when you don't know whether what
> you're doing is work or play
> -------------------------------------
> To achieve the impossible dream, try going to sleep.
> -------------------------------------
> Facts do not cease to exist because they are ignored.
> -------------------------------------
> Typing monkeys will write all Shakespeare's works in 200yrs.Will they
> write all patents, too? :)
> -------------------------------------
> Sanity is madness put to good use.
> -------------------------------------
> I finally figured out the only reason to be alive is to enjoy it.
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help



--=20
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write
all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

--0000000000009852c505d116e3bd
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 Thu, Nov 18, 2021 at 11:34 AM Mich=
ael Kay &lt;<a href=3D"mailto:mike-JkSD5nQpfvpWk0Htik3J/[email protected]">mike-JkSD5nQpfvpWk0Htik3J/[email protected]</a>&gt; =
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div styl=
e=3D"overflow-wrap: break-word;">It&#39;s not possible to provide run-time =
access to ALL variables, because many variables (both local and global) are=
 eliminated or rewritten at compile time. For example a variable has no det=
ectable existence at run-time if it was found to be unused, or if it was in=
lined, or if it was replaced by a different variable (for example replacing=
 a variable bound to @price with one that&#39;s bound to data(@price)).<div=
><br></div><div>You&#39;ll see this if you look at a Saxon stack-trace afte=
r a dynamic error - it shows the variables that exist at run-time, which ma=
y exclude some that existed at compile time, and also include others that w=
ere generated by the compiler.</div><div><br></div></div></blockquote><div>=
<br></div><div>Still, providing data about the known variables is valuable =
in a range of use-cases as this one.<br>This could be considered &quot;debu=
gging&quot; or &quot;detecting unexpected errors&quot;.</div><div><br></div=
><div>Thanks,</div><div>Dimitre</div><div>=C2=A0</div><blockquote class=3D"=
gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(20=
4,204,204);padding-left:1ex"><div style=3D"overflow-wrap: break-word;"><div=
></div><div>Michael Kay</div><div>Saxonica<br><div><br></div><div><br><div>=
<br><blockquote type=3D"cite"><div>On 18 Nov 2021, at 15:25, Dimitre Novatc=
hev &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">dnovatche=
[email protected]</a>&gt; wrote:</div><br><div><div dir=3D"ltr">In July I asked t=
his on the <a href=3D"http://XML.com" target=3D"_blank">XML.com</a> Slack #=
xpath-ng channel (and your question is exactly one use-case for this propos=
al):<br><br><a href=3D"https://xmlcom.slack.com/archives/C01GVC3JLHE/p16255=
34819029200" target=3D"_blank">https://xmlcom.slack.com/archives/C01GVC3JLH=
E/p1625534819029200</a><br><br><div role=3D"presentation" id=3D"gmail-m_-13=
81410131120470319gmail-1625468400000divider"><div><div></div></div></div><d=
iv role=3D"listitem" id=3D"gmail-m_-1381410131120470319gmail-1625534819.029=
200"><div role=3D"presentation"><div role=3D"document"><div><div><div role=
=3D"presentation"></div></div></div></div></div></div><span><a rel=3D"noope=
ner noreferrer" aria-haspopup=3D"menu" aria-expanded=3D"false" href=3D"http=
s://app.slack.com/team/U01F9LEC4SE" target=3D"_blank">Dimitre Novatchev<spa=
n aria-label=3D"(opens in new tab)"></span></a></span>=C2=A0=C2=A0<a href=
=3D"https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200" target=
=3D"_blank"><span>6:26 PM</span></a><br><div><div><div><div><div dir=3D"aut=
o"><div>Question: AFAIK we don&#39;t have an <span>XPath</span> function th=
at returns all variables/parameters=C2=A0 that are in context, do we?</div>=
<div><span></span>Please, correct me if I am wrong.<span></span>Having such=
 a function will be useful for debugging and other goals. Any thoughts?<br>=
<br>There was a thread on this with 27 responses, most positive, the questi=
on got 7 thumbs-up, but I am not aware of anything been done further.<br><b=
r>Probably must add this as an official proposal on <a href=3D"https://gith=
ub.com/qt4cg/qtspecs/issues" target=3D"_blank">https://github.com/qt4cg/qts=
pecs/issues</a></div><div><br><br>Thanks,</div><div>Dimitre</div></div></di=
v></div></div></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" c=
lass=3D"gmail_attr">On Wed, Nov 17, 2021 at 11:16 AM Graydon Saunders &lt;<=
a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
om</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
"><div dir=3D"ltr"><div style=3D"font-size:small">Hello!<br></div><div styl=
e=3D"font-size:small"><br></div><div style=3D"font-size:small">I am pretty =
sure there isn&#39;t a way to do this, but maybe I&#39;m wrong.</div><div s=
tyle=3D"font-size:small"><br></div><div style=3D"font-size:small">In curren=
t Saxon -- 10.* -- using XSLT 3.0, is there some way to get a list of the s=
tylesheet parameters?=C2=A0=C2=A0</div><div style=3D"font-size:small"><br><=
/div><div style=3D"font-size:small">The intent is to then check that they a=
ll have values assigned, since one of the ways the &quot;call this styleshe=
et&quot; step of the processing chain fails is &quot;oops, that needs a val=
ue&quot;.=C2=A0 There&#39;s an extension function, saxon:tunnel-params(), t=
hat would be just the thing if it were saxon:in-scope-params().</div><div s=
tyle=3D"font-size:small"><br></div><div style=3D"font-size:small">(If not, =
an explicit list of parameters will work.=C2=A0 I am hoping for a more eleg=
ant solution.)</div><div style=3D"font-size:small"><br></div><div style=3D"=
font-size:small">Thanks!</div><div style=3D"font-size:small"><br></div><div=
 style=3D"font-size:small">---<br>Graydon Saunders =C2=A0| <a href=3D"mailt=
o:[email protected]" target=3D"_blank">[email protected]</a><br>=C3=
=9E=C3=A6s ofer=C3=A9ode, =C3=B0isses sw=C3=A1 m=C3=A6g.<br>-- Deor =C2=A0(=
&quot;That passed, so may this.&quot;)<br></div></div>
_______________________________________________<br>
saxon-help mailing list archived at <a href=3D"http://saxon.markmail.org/" =
rel=3D"noreferrer" target=3D"_blank">http://saxon.markmail.org/</a><br>
<a href=3D"mailto:[email protected]" target=3D"_blank">saxon=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/saxon-help" rel=3D"=
noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/=
saxon-help</a> </blockquote></div><br clear=3D"all"><div><br></div>-- <br><=
div dir=3D"ltr"><div>Cheers,</div><div>Dimitre Novatchev</div><div>--------=
-------------------------------</div><div>Truly great madness cannot be ach=
ieved without significant intelligence.</div><div>-------------------------=
--------------</div><div>To invent, you need a good imagination and a pile =
of junk</div><div>-------------------------------------</div><div>Never fig=
ht an inanimate object</div><div>-------------------------------------</div=
><div>To avoid situations in which you might make mistakes may be the</div>=
<div>biggest mistake of all</div><div>------------------------------------<=
/div><div>Quality means doing it right when no one is looking.</div><div>--=
-----------------------------------</div><div>You&#39;ve achieved success i=
n your field when you don&#39;t know whether what you&#39;re doing is work =
or play</div><div>-------------------------------------</div><div>To achiev=
e the impossible dream, try going to sleep.</div><div>---------------------=
----------------</div><div>Facts do not cease to exist because they are ign=
ored.</div><div>-------------------------------------</div><div>Typing monk=
eys will write all Shakespeare&#39;s works in 200yrs.Will they write all pa=
tents, too? :)</div><div>-------------------------------------</div><div>Sa=
nity is madness put to good use.</div><div>--------------------------------=
-----</div><div>I finally figured out the only reason to be alive is to enj=
oy it.</div><div>=C2=A0</div></div>
_______________________________________________<br>saxon-help mailing list =
archived at <a href=3D"http://saxon.markmail.org/" target=3D"_blank">http:/=
/saxon.markmail.org/</a><br><a href=3D"mailto:[email protected]=
net" target=3D"_blank">[email protected]</a><br><a href=3D"h=
ttps://lists.sourceforge.net/lists/listinfo/saxon-help" target=3D"_blank">h=
ttps://lists.sourceforge.net/lists/listinfo/saxon-help</a> </div></blockquo=
te></div><br></div></div></div>____________________________________________=
___<br>
saxon-help mailing list archived at <a href=3D"http://saxon.markmail.org/" =
rel=3D"noreferrer" target=3D"_blank">http://saxon.markmail.org/</a><br>
<a href=3D"mailto:[email protected]" target=3D"_blank">saxon=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/saxon-help" rel=3D"=
noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/=
saxon-help</a> </blockquote></div><br clear=3D"all"><div><br></div>-- <br><=
div dir=3D"ltr" class=3D"gmail_signature"><div>Cheers,</div><div>Dimitre No=
vatchev</div><div>---------------------------------------</div><div>Truly g=
reat madness cannot be achieved without significant intelligence.</div><div=
>---------------------------------------</div><div>To invent, you need a go=
od imagination and a pile of junk</div><div>-------------------------------=
------</div><div>Never fight an inanimate object</div><div>----------------=
---------------------</div><div>To avoid situations in which you might make=
 mistakes may be the</div><div>biggest mistake of all</div><div>-----------=
-------------------------</div><div>Quality means doing it right when no on=
e is looking.</div><div>-------------------------------------</div><div>You=
&#39;ve achieved success in your field when you don&#39;t know whether what=
 you&#39;re doing is work or play</div><div>-------------------------------=
------</div><div>To achieve the impossible dream, try going to sleep.</div>=
<div>-------------------------------------</div><div>Facts do not cease to =
exist because they are ignored.</div><div>---------------------------------=
----</div><div>Typing monkeys will write all Shakespeare&#39;s works in 200=
yrs.Will they write all patents, too? :)</div><div>------------------------=
-------------</div><div>Sanity is madness put to good use.</div><div>------=
-------------------------------</div><div>I finally figured out the only re=
ason to be alive is to enjoy it.</div><div>=C2=A0</div></div></div>

--0000000000009852c505d116e3bd--


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


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

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
--===============8775340252230365677==--