Re: List of stylesheet parameters?

Graydon Saunders <[email protected]> Thu, 18 Nov 2021 20:42:23 -0500
Newsgroups gmane.text.xml.saxon.help
Message-ID <CAO3ciQHB3opCojfFjAKMned+vEvFnU3Xs2tjRB=J=f9S505FHg@mail.gmail.com>
--===============6692378935070924472==
Content-Type: multipart/alternative; boundary="000000000000a0cd9105d11a63e7"

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

*This is when the cat bites itself in the tail, as we say in Germany.*

I will have to remember that one!

Thankfully, I know what all the parameters are, and I know what the types
should be, so checking that something is present isn't too hard.  This is a
check that the calling program hasn't had a failure.   The particular value
of concern is the base URI for the parameters to several transform() calls,
as:

<xsl:map-entry key=3D"'stylesheet-location'"
select=3D"resolve-uri('stepOne.xsl',$base)" />

If $base isn't defined Saxon exits politely with an error message but it's
an error message about an internal-to-Saxon variable not being defined and
confusion results.

Thank you!

On Thu, Nov 18, 2021 at 4:29 AM Imsieke, Gerrit, le-tex <
[email protected]> wrote:

> Ah ok.
>
> I was hoping that xsl:evaluate can be used to evaluate the actual values
> of parameters, but you need to pass these parameters to xsl:evaluate
> explicitly. This is when the cat bites itself in the tail, as we say in
> Germany.
>
> Unless Saxonica introduces an extension function that makes the
> variable/parameter bindings available as a map (or unless I=E2=80=99m
> overlooking something, which is always possible), I agree that there is
> no way to access this information directly.
>
> An indirect approach: One could use the stylesheet-analyzing stylesheet
> in order to generate XSLT that the stylesheet in question includes. In
> this XSLT, maybe in a named template that you can call from your
> stylesheet, the dynamic values of the global parameters can be compared
> to the default values, for example.
>
> Gerrit
>
>
> On 18.11.2021 00:54, Graydon Saunders wrote:
> > Thank you, Gerrit!
> >
> > I am pretty sure that's going to inspect the XSLT code, so I've been
> > unclear.
> >
> > What I want is to be able to detect the in-scope parameters at the top
> > of the stylesheet (and whatever values those parameters have) _while th=
e
> > stylesheet is running_, as a sort of last-ditch check that these
> > parameters have values.  (Possibly "usable values", but "values" for
> now.)
> >
> > As I said, I'm pretty sure that's not something one can do.
> >
> > -- Graydon
> >
> > On Wed, Nov 17, 2021 at 4:16 PM Imsieke, Gerrit, le-tex
> > <[email protected] <mailto:[email protected]>> wrote:
> >
> >     Hi Graydon,
> >
> >     You can extract the stylesheet parameters with XSLT. You need to
> follow
> >     the includes and imports and report only the topmost (non-overridde=
n)
> >     xsl:params. I set up a small repo that does just this, not
> considering
> >     packages though.
> >
> >     https://github.com/gimsieke/xsl-params/
> >     <https://github.com/gimsieke/xsl-params/>
> >
> >     Gerrit
> >
> >
> >     On 17.11.2021 20:15, Graydon Saunders 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
> >      > one of the ways the "call this stylesheet" step of the processin=
g
> >     chain
> >      > fails 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]
> >     <mailto:[email protected]> <mailto:[email protected]
> >     <mailto:[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/
> >     <http://saxon.markmail.org/>
> >     [email protected]
> >     <mailto:[email protected]>
> >     https://lists.sourceforge.net/lists/listinfo/saxon-help
> >     <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
> >
>
> --
> Gerrit Imsieke
> Gesch=C3=A4ftsf=C3=BChrer / Managing Director
> le-tex publishing services GmbH
> Weissenfelser Str. 84, 04229 Leipzig, Germany
> Phone +49 341 355356 110, Fax +49 341 355356 510
> [email protected], http://www.le-tex.de
>
> Registergericht / Commercial Register: Amtsgericht Leipzig
> Registernummer / Registration Number: HRB 24930
>
> Gesch=C3=A4ftsf=C3=BChrer / Managing Directors:
> Gerrit Imsieke, Svea Jelonek, Thomas Schmidt
>
>
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help

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

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-size:small"><i>=
<span style=3D"color:rgb(0,0,0)">This is when the cat bites itself in the t=
ail, as we say in=C2=A0</span><span style=3D"color:rgb(0,0,0)">Germany.</sp=
an><br></i></div><div class=3D"gmail_default" style=3D"font-size:small"><sp=
an style=3D"color:rgb(0,0,0)"><br></span></div><div class=3D"gmail_default"=
 style=3D"font-size:small"><span style=3D"color:rgb(0,0,0)">I will have to =
remember that one!</span></div><div class=3D"gmail_default" style=3D"font-s=
ize:small"><span style=3D"color:rgb(0,0,0)"><br></span></div><div class=3D"=
gmail_default" style=3D"font-size:small"><font color=3D"#000000">Thankfully=
, I know what all the parameters are, and I know what the types should be, =
so checking that something is present isn&#39;t too hard.=C2=A0 This is a c=
heck that the calling program hasn&#39;t had a failure.=C2=A0 =C2=A0The par=
ticular value of concern is the base URI for the parameters to several tran=
sform() calls, as:</font></div><div class=3D"gmail_default" style=3D"font-s=
ize:small"><font color=3D"#000000"><br></font></div><div class=3D"gmail_def=
ault" style=3D"font-size:small">&lt;xsl:map-entry key=3D&quot;&#39;styleshe=
et-location&#39;&quot; select=3D&quot;resolve-uri(&#39;stepOne.xsl&#39;,$ba=
se)&quot; /&gt;<font color=3D"#000000"><br></font></div><div class=3D"gmail=
_default" style=3D"font-size:small"><font color=3D"#000000"><br></font></di=
v><div class=3D"gmail_default" style=3D"font-size:small"><font color=3D"#00=
0000">If $base isn&#39;t defined Saxon exits politely with an error message=
 but it&#39;s an error message about an internal-to-Saxon variable not bein=
g defined and confusion results.</font></div><div class=3D"gmail_default" s=
tyle=3D"font-size:small"><font color=3D"#000000"><br></font></div><div clas=
s=3D"gmail_default" style=3D"font-size:small"><font color=3D"#000000">Thank=
 you!</font></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" cla=
ss=3D"gmail_attr">On Thu, Nov 18, 2021 at 4:29 AM Imsieke, Gerrit, le-tex &=
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">Ah o=
k.<br>
<br>
I was hoping that xsl:evaluate can be used to evaluate the actual values <b=
r>
of parameters, but you need to pass these parameters to xsl:evaluate <br>
explicitly. This is when the cat bites itself in the tail, as we say in <br=
>
Germany.<br>
<br>
Unless Saxonica introduces an extension function that makes the <br>
variable/parameter bindings available as a map (or unless I=E2=80=99m <br>
overlooking something, which is always possible), I agree that there is <br=
>
no way to access this information directly.<br>
<br>
An indirect approach: One could use the stylesheet-analyzing stylesheet <br=
>
in order to generate XSLT that the stylesheet in question includes. In <br>
this XSLT, maybe in a named template that you can call from your <br>
stylesheet, the dynamic values of the global parameters can be compared <br=
>
to the default values, for example.<br>
<br>
Gerrit<br>
<br>
<br>
On 18.11.2021 00:54, Graydon Saunders wrote:<br>
&gt; Thank you, Gerrit!<br>
&gt; <br>
&gt; I am pretty sure that&#39;s going to inspect the XSLT code, so I&#39;v=
e been <br>
&gt; unclear.<br>
&gt; <br>
&gt; What I want is to be able to detect the in-scope parameters at the top=
 <br>
&gt; of the stylesheet (and whatever values those parameters have) _while t=
he <br>
&gt; stylesheet is running_, as a sort of last-ditch check that these <br>
&gt; parameters have values.=C2=A0 (Possibly &quot;usable values&quot;, but=
 &quot;values&quot; for now.)<br>
&gt; <br>
&gt; As I said, I&#39;m pretty sure that&#39;s not something one can do.<br=
>
&gt; <br>
&gt; -- Graydon<br>
&gt; <br>
&gt; On Wed, Nov 17, 2021 at 4:16 PM Imsieke, Gerrit, le-tex <br>
&gt; &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">gerr=
[email protected]</a> &lt;mailto:<a href=3D"mailto:gerrit.imsieke@le-tex=
.de" target=3D"_blank">[email protected]</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Hi Graydon,<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0You can extract the stylesheet parameters with XSLT=
. You need to follow<br>
&gt;=C2=A0 =C2=A0 =C2=A0the includes and imports and report only the topmos=
t (non-overridden)<br>
&gt;=C2=A0 =C2=A0 =C2=A0xsl:params. I set up a small repo that does just th=
is, not considering<br>
&gt;=C2=A0 =C2=A0 =C2=A0packages though.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"https://github.com/gimsieke/xsl-params/"=
 rel=3D"noreferrer" target=3D"_blank">https://github.com/gimsieke/xsl-param=
s/</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/gimsieke/xsl-para=
ms/" rel=3D"noreferrer" target=3D"_blank">https://github.com/gimsieke/xsl-p=
arams/</a>&gt;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Gerrit<br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 17.11.2021 20:15, Graydon Saunders wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Hello!<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; I am pretty sure there isn&#39;t a way to do =
this, but maybe I&#39;m wrong.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; In current Saxon -- 10.* -- using XSLT 3.0, i=
s there some way to<br>
&gt;=C2=A0 =C2=A0 =C2=A0get a<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; list of the stylesheet parameters?<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; The intent is to then check that they all hav=
e values assigned,<br>
&gt;=C2=A0 =C2=A0 =C2=A0since<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; one of the ways the &quot;call this styleshee=
t&quot; step of the processing<br>
&gt;=C2=A0 =C2=A0 =C2=A0chain<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; fails is &quot;oops, that needs a value&quot;=
.=C2=A0 There&#39;s an extension function,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; saxon:tunnel-params(), that would be just the=
 thing if it were<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; saxon:in-scope-params().<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; (If not, an explicit list of parameters will =
work.=C2=A0 I am hoping<br>
&gt;=C2=A0 =C2=A0 =C2=A0for a<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; more elegant solution.)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Thanks!<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; ---<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Graydon Saunders =C2=A0| <a href=3D"mailto:gr=
[email protected]" target=3D"_blank">[email protected]</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt; &lt;mailto:<a href=3D"mailto=
:[email protected]" target=3D"_blank">[email protected]</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; =C3=9E=C3=A6s ofer=C3=A9ode, =C3=B0isses sw=
=C3=A1 m=C3=A6g.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; -- Deor =C2=A0(&quot;That passed, so may this=
.&quot;)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0_______________________________________________<br>
&gt;=C2=A0 =C2=A0 =C2=A0saxon-help mailing list archived at <a href=3D"http=
://saxon.markmail.org/" rel=3D"noreferrer" target=3D"_blank">http://saxon.m=
arkmail.org/</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"http://saxon.markmail.org/" rel=3D"n=
oreferrer" target=3D"_blank">http://saxon.markmail.org/</a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:[email protected]=
eforge.net" target=3D"_blank">[email protected]</a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"https://lists.sourceforge.net/lists/list=
info/saxon-help" rel=3D"noreferrer" target=3D"_blank">https://lists.sourcef=
orge.net/lists/listinfo/saxon-help</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://lists.sourceforge.net/lists/=
listinfo/saxon-help" rel=3D"noreferrer" target=3D"_blank">https://lists.sou=
rceforge.net/lists/listinfo/saxon-help</a>&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; saxon-help mailing list archived at <a href=3D"http://saxon.markmail.o=
rg/" rel=3D"noreferrer" target=3D"_blank">http://saxon.markmail.org/</a><br=
>
&gt; <a href=3D"mailto:[email protected]" target=3D"_blank">=
[email protected]</a><br>
&gt; <a href=3D"https://lists.sourceforge.net/lists/listinfo/saxon-help" re=
l=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/list=
info/saxon-help</a><br>
&gt; <br>
<br>
-- <br>
Gerrit Imsieke<br>
Gesch=C3=A4ftsf=C3=BChrer / Managing Director<br>
le-tex publishing services GmbH<br>
Weissenfelser Str. 84, 04229 Leipzig, Germany<br>
Phone +49 341 355356 110, Fax +49 341 355356 510<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">gerrit.imsiek=
[email protected]</a>, <a href=3D"http://www.le-tex.de" rel=3D"noreferrer" target=
=3D"_blank">http://www.le-tex.de</a><br>
<br>
Registergericht / Commercial Register: Amtsgericht Leipzig<br>
Registernummer / Registration Number: HRB 24930<br>
<br>
Gesch=C3=A4ftsf=C3=BChrer / Managing Directors:<br>
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt<br>
<br>
<br>
_______________________________________________<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>

--000000000000a0cd9105d11a63e7--


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


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