Re: List of stylesheet parameters?
Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]> Thu, 18 Nov 2021 19:13:09 +0000
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
--===============1385728767177041390== Content-Type: multipart/alternative; boundary="Apple-Mail=_B78EFA59-75F9-4638-9317-A93857D15451" --Apple-Mail=_B78EFA59-75F9-4638-9317-A93857D15451 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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 = that existed at compile time, and also include others that were = generated by the compiler. Michael Kay Saxonica > On 18 Nov 2021, at 15:25, Dimitre Novatchev <[email protected]> = wrote: >=20 > In July I asked this on the XML.com Slack #xpath-ng channel (and your = question is exactly one use-case for this proposal): >=20 > https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200 = <https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200> >=20 > 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? >=20 > 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. >=20 > Probably must add this as an official proposal on = https://github.com/qt4cg/qtspecs/issues = <https://github.com/qt4cg/qtspecs/issues> >=20 >=20 > Thanks, > Dimitre >=20 > On Wed, Nov 17, 2021 at 11:16 AM Graydon Saunders = <[email protected] <mailto:[email protected]>> wrote: > Hello! >=20 > I am pretty sure there isn't a way to do this, but maybe I'm wrong. >=20 > In current Saxon -- 10.* -- using XSLT 3.0, is there some way to get a = list of the stylesheet parameters? =20 >=20 > The intent is to then check that they all have values assigned, since = one of the ways the "call this stylesheet" step of the processing 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(). >=20 > (If not, an explicit list of parameters will work. I am hoping for a = more elegant solution.) >=20 > Thanks! >=20 > --- > Graydon Saunders | [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> >=20 > --=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. > =20 > _______________________________________________ > saxon-help mailing list archived at http://saxon.markmail.org/ > [email protected] > https://lists.sourceforge.net/lists/listinfo/saxon-help --Apple-Mail=_B78EFA59-75F9-4638-9317-A93857D15451 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">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)).<div class=3D""><br = class=3D""></div><div class=3D"">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 that existed at compile time, and also = include others that were generated by the compiler.</div><div = class=3D""><br class=3D""></div><div class=3D"">Michael Kay</div><div = class=3D"">Saxonica<br class=3D""><div class=3D""><br = class=3D""></div><div class=3D""><br class=3D""><div><br = class=3D""><blockquote type=3D"cite" class=3D""><div class=3D"">On 18 = Nov 2021, at 15:25, Dimitre Novatchev <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div dir=3D"ltr" = class=3D"">In July I asked this on the <a href=3D"http://XML.com" = class=3D"">XML.com</a> Slack #xpath-ng channel (and your question is = exactly one use-case for this proposal):<br class=3D""><br class=3D""><a = href=3D"https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200" = class=3D"">https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200= </a><br class=3D""><br class=3D""><div = class=3D"gmail-c-virtual_list__item" tabindex=3D"-1" role=3D"presentation"= style=3D"top: 1157.7px;" id=3D"gmail-1625468400000divider"><div = class=3D"gmail-c-message_list__day_divider"><div = class=3D"gmail-c-message_list__day_divider__line"></div></div></div><div = class=3D"gmail-c-virtual_list__item" tabindex=3D"0" role=3D"listitem" = style=3D"top: 1197.7px;" id=3D"gmail-1625534819.029200"><div = role=3D"presentation" class=3D"gmail-c-message_kit__background = gmail-c-message_kit__background--hovered = gmail-p-message_pane_message__message gmail-c-message_kit__message"><div = role=3D"document" class=3D"gmail-c-message_kit__hover = gmail-c-message_kit__hover--hovered"><div = class=3D"gmail-c-message_kit__actions--default = gmail-c-message_kit__actions" style=3D""><div = class=3D"gmail-c-message_kit__gutter"><div role=3D"presentation" = class=3D"gmail-c-message_kit__gutter__left"></div></div></div></div></div>= </div><span class=3D"gmail-c-message__sender = gmail-c-message_kit__sender"><a target=3D"_blank" rel=3D"noopener = noreferrer" aria-haspopup=3D"menu" aria-expanded=3D"false" = class=3D"gmail-c-link gmail-c-message__sender_link" = href=3D"https://app.slack.com/team/U01F9LEC4SE" tabindex=3D"-1">Dimitre = Novatchev<span aria-label=3D"(opens in new tab)" = class=3D""></span></a></span> <a class=3D"gmail-c-link = gmail-c-timestamp" = href=3D"https://xmlcom.slack.com/archives/C01GVC3JLHE/p1625534819029200" = tabindex=3D"-1"><span class=3D"gmail-c-timestamp__label">6:26 = PM</span></a><br class=3D""><div class=3D"gmail-c-message_kit__blocks = gmail-c-message_kit__blocks--rich_text"><div = class=3D"gmail-c-message__message_blocks = gmail-c-message__message_blocks--rich_text"><div = class=3D"gmail-p-block_kit_renderer"><div = class=3D"gmail-p-block_kit_renderer__block_wrapper = gmail-p-block_kit_renderer__block_wrapper--first"><div = class=3D"gmail-p-rich_text_block" dir=3D"auto"><div = class=3D"gmail-p-rich_text_section">Question: AFAIK we don't have an = <span class=3D"gmail-c-mrkdwn__highlight">XPath</span> function that = returns all variables/parameters that are in context, do = we?</div><div class=3D"gmail-p-rich_text_section"><span = class=3D"gmail-c-mrkdwn__br"></span>Please, correct me if I am = wrong.<span class=3D"gmail-c-mrkdwn__br"></span>Having such a function = will be useful for debugging and other goals. Any thoughts?<br = class=3D""><br class=3D"">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.<br class=3D""><br class=3D"">Probably must = add this as an official proposal on <a = href=3D"https://github.com/qt4cg/qtspecs/issues" = class=3D"">https://github.com/qt4cg/qtspecs/issues</a></div><div = class=3D"gmail-p-rich_text_section"><br class=3D""><br = class=3D"">Thanks,</div><div = class=3D"gmail-p-rich_text_section">Dimitre</div></div></div></div></div><= /div></div><br class=3D""><div class=3D"gmail_quote"><div dir=3D"ltr" = class=3D"gmail_attr">On Wed, Nov 17, 2021 at 11:16 AM Graydon Saunders = <<a href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:<br = class=3D""></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" class=3D""><div = class=3D"gmail_default" style=3D"font-size:small">Hello!<br = class=3D""></div><div class=3D"gmail_default" = style=3D"font-size:small"><br class=3D""></div><div = class=3D"gmail_default" style=3D"font-size:small">I am pretty sure there = isn't a way to do this, but maybe I'm wrong.</div><div = class=3D"gmail_default" style=3D"font-size:small"><br = class=3D""></div><div class=3D"gmail_default" style=3D"font-size:small">In= current Saxon -- 10.* -- using XSLT 3.0, is there some way to get a = list of the stylesheet parameters? </div><div = class=3D"gmail_default" style=3D"font-size:small"><br = class=3D""></div><div class=3D"gmail_default" = style=3D"font-size:small">The intent is to then check that they all have = values assigned, since one of the ways the "call this stylesheet" step = of the processing 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().</div><div = class=3D"gmail_default" style=3D"font-size:small"><br = class=3D""></div><div class=3D"gmail_default" = style=3D"font-size:small">(If not, an explicit list of parameters will = work. I am hoping for a more elegant solution.)</div><div = class=3D"gmail_default" style=3D"font-size:small"><br = class=3D""></div><div class=3D"gmail_default" = style=3D"font-size:small">Thanks!</div><div class=3D"gmail_default" = style=3D"font-size:small"><br class=3D""></div><div = class=3D"gmail_default" style=3D"font-size:small">---<br = class=3D"">Graydon Saunders | <a = href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a><br class=3D"">=C3=9E=C3=A6s = ofer=C3=A9ode, =C3=B0isses sw=C3=A1 m=C3=A6g.<br class=3D"">-- Deor = ("That passed, so may this.")<br class=3D""></div></div> _______________________________________________<br class=3D""> saxon-help mailing list archived at <a href=3D"http://saxon.markmail.org/"= rel=3D"noreferrer" target=3D"_blank" = class=3D"">http://saxon.markmail.org/</a><br class=3D""> <a href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a><br class=3D""> <a href=3D"https://lists.sourceforge.net/lists/listinfo/saxon-help" = rel=3D"noreferrer" target=3D"_blank" = class=3D"">https://lists.sourceforge.net/lists/listinfo/saxon-help</a> = </blockquote></div><br clear=3D"all" class=3D""><div class=3D""><br = class=3D""></div>-- <br class=3D""><div dir=3D"ltr" = class=3D"gmail_signature"><div class=3D"">Cheers,</div><div = class=3D"">Dimitre Novatchev</div><div = class=3D"">---------------------------------------</div><div = class=3D"">Truly great madness cannot be achieved without significant = intelligence.</div><div = class=3D"">---------------------------------------</div><div class=3D"">To= invent, you need a good imagination and a pile of junk</div><div = class=3D"">-------------------------------------</div><div = class=3D"">Never fight an inanimate object</div><div = class=3D"">-------------------------------------</div><div class=3D"">To = avoid situations in which you might make mistakes may be the</div><div = class=3D"">biggest mistake of all</div><div = class=3D"">------------------------------------</div><div = class=3D"">Quality means doing it right when no one is = looking.</div><div = class=3D"">-------------------------------------</div><div = class=3D"">You've achieved success in your field when you don't know = whether what you're doing is work or play</div><div = class=3D"">-------------------------------------</div><div class=3D"">To = achieve the impossible dream, try going to sleep.</div><div = class=3D"">-------------------------------------</div><div = class=3D"">Facts do not cease to exist because they are = ignored.</div><div = class=3D"">-------------------------------------</div><div = class=3D"">Typing monkeys will write all Shakespeare's works in = 200yrs.Will they write all patents, too? :)</div><div = class=3D"">-------------------------------------</div><div = class=3D"">Sanity is madness put to good use.</div><div = class=3D"">-------------------------------------</div><div class=3D"">I = finally figured out the only reason to be alive is to enjoy = it.</div><div class=3D""> </div></div> _______________________________________________<br class=3D"">saxon-help = mailing list archived at <a href=3D"http://saxon.markmail.org/" = class=3D"">http://saxon.markmail.org/</a><br class=3D""><a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a><br = class=3D"">https://lists.sourceforge.net/lists/listinfo/saxon-help = </div></blockquote></div><br class=3D""></div></div></body></html>= --Apple-Mail=_B78EFA59-75F9-4638-9317-A93857D15451-- --===============1385728767177041390== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============1385728767177041390== 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 --===============1385728767177041390==--