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't too hard.=C2=A0 This is a c=
heck that the calling program hasn'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"><xsl:map-entry key=3D"'styleshe=
et-location'" select=3D"resolve-uri('stepOne.xsl',$ba=
se)" /><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't defined Saxon exits politely with an error message=
but it'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>=
> 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>
> Thank you, Gerrit!<br>
> <br>
> I am pretty sure that's going to inspect the XSLT code, so I'v=
e been <br>
> unclear.<br>
> <br>
> What I want is to be able to detect the in-scope parameters at the top=
<br>
> of the stylesheet (and whatever values those parameters have) _while t=
he <br>
> stylesheet is running_, as a sort of last-ditch check that these <br>
> parameters have values.=C2=A0 (Possibly "usable values", but=
"values" for now.)<br>
> <br>
> As I said, I'm pretty sure that's not something one can do.<br=
>
> <br>
> -- Graydon<br>
> <br>
> On Wed, Nov 17, 2021 at 4:16 PM Imsieke, Gerrit, le-tex <br>
> <<a href=3D"mailto:[email protected]" target=3D"_blank">gerr=
[email protected]</a> <mailto:<a href=3D"mailto:gerrit.imsieke@le-tex=
.de" target=3D"_blank">[email protected]</a>>> wrote:<br>
> <br>
>=C2=A0 =C2=A0 =C2=A0Hi Graydon,<br>
> <br>
>=C2=A0 =C2=A0 =C2=A0You can extract the stylesheet parameters with XSLT=
. You need to follow<br>
>=C2=A0 =C2=A0 =C2=A0the includes and imports and report only the topmos=
t (non-overridden)<br>
>=C2=A0 =C2=A0 =C2=A0xsl:params. I set up a small repo that does just th=
is, not considering<br>
>=C2=A0 =C2=A0 =C2=A0packages though.<br>
> <br>
>=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>
>=C2=A0 =C2=A0 =C2=A0<<a href=3D"https://github.com/gimsieke/xsl-para=
ms/" rel=3D"noreferrer" target=3D"_blank">https://github.com/gimsieke/xsl-p=
arams/</a>><br>
> <br>
>=C2=A0 =C2=A0 =C2=A0Gerrit<br>
> <br>
> <br>
>=C2=A0 =C2=A0 =C2=A0On 17.11.2021 20:15, Graydon Saunders wrote:<br>
>=C2=A0 =C2=A0 =C2=A0 > Hello!<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 > I am pretty sure there isn't a way to do =
this, but maybe I'm wrong.<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 > In current Saxon -- 10.* -- using XSLT 3.0, i=
s there some way to<br>
>=C2=A0 =C2=A0 =C2=A0get a<br>
>=C2=A0 =C2=A0 =C2=A0 > list of the stylesheet parameters?<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 > The intent is to then check that they all hav=
e values assigned,<br>
>=C2=A0 =C2=A0 =C2=A0since<br>
>=C2=A0 =C2=A0 =C2=A0 > one of the ways the "call this styleshee=
t" step of the processing<br>
>=C2=A0 =C2=A0 =C2=A0chain<br>
>=C2=A0 =C2=A0 =C2=A0 > fails is "oops, that needs a value"=
.=C2=A0 There's an extension function,<br>
>=C2=A0 =C2=A0 =C2=A0 > saxon:tunnel-params(), that would be just the=
thing if it were<br>
>=C2=A0 =C2=A0 =C2=A0 > saxon:in-scope-params().<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 > (If not, an explicit list of parameters will =
work.=C2=A0 I am hoping<br>
>=C2=A0 =C2=A0 =C2=A0for a<br>
>=C2=A0 =C2=A0 =C2=A0 > more elegant solution.)<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 > Thanks!<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 > ---<br>
>=C2=A0 =C2=A0 =C2=A0 > Graydon Saunders =C2=A0| <a href=3D"mailto:gr=
[email protected]" target=3D"_blank">[email protected]</a><br>
>=C2=A0 =C2=A0 =C2=A0<mailto:<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>> <mailto:<a href=3D"mailto=
:[email protected]" target=3D"_blank">[email protected]</a><br>
>=C2=A0 =C2=A0 =C2=A0<mailto:<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>>><br>
>=C2=A0 =C2=A0 =C2=A0 > =C3=9E=C3=A6s ofer=C3=A9ode, =C3=B0isses sw=
=C3=A1 m=C3=A6g.<br>
>=C2=A0 =C2=A0 =C2=A0 > -- Deor =C2=A0("That passed, so may this=
.")<br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
>=C2=A0 =C2=A0 =C2=A0 ><br>
> <br>
> <br>
>=C2=A0 =C2=A0 =C2=A0_______________________________________________<br>
>=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>
>=C2=A0 =C2=A0 =C2=A0<<a href=3D"http://saxon.markmail.org/" rel=3D"n=
oreferrer" target=3D"_blank">http://saxon.markmail.org/</a>><br>
>=C2=A0 =C2=A0 =C2=A0<a href=3D"mailto:[email protected]"=
target=3D"_blank">[email protected]</a><br>
>=C2=A0 =C2=A0 =C2=A0<mailto:<a href=3D"mailto:[email protected]=
eforge.net" target=3D"_blank">[email protected]</a>><br>
>=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>
>=C2=A0 =C2=A0 =C2=A0<<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>> <br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> 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=
>
> <a href=3D"mailto:[email protected]" target=3D"_blank">=
[email protected]</a><br>
> <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>
> <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==--