Re: Spurious error on recursive invocation of fn:transform
Dimitre Novatchev <[email protected]> Mon, 23 Nov 2020 12:50:23 -0800
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <CAK4KnZeEHJ5RomNwJn71_g06RgysoaWXRxdqPULhVAC08xFeAg@mail.gmail.com> |
> Having a stylesheet read it's own source code using doc("") is a pretty
dreadful hack
> and really has no place in modern XSLT code. In the general case where
compiled stylesheets are deployed around the world,
> the source code isn't available at execution time anyway.
Then change the official XSLT 1.0 specification and inform all the XSLT 1.0
user's whose code will suddenly start failing.
I very much agree with what Tommie expressed in the other thread.
One person, or one company should not dictate what version of a product the
users should be using. If 90%+ of all users happen not to be acquainted
with Version N and are rooted just upon ver. 1 or 2, maybe one needs to
find out the real reasons for this. Maybe the new versions are too-complex,
lack understandable specifications, occupy 400+ pages, or reflect only the
viewpoint of a single person or a small group of people who are "in the
clouds" and not real, typical users. Trying to give us a significantly
stepped-up version once in 10 years is not a winning strategy. Look how the
successful products (e.g. Typescript, Angular, React, Vue) do it. They
release often, every 6 or 12 months, and what they release is a small chunk
of new features, not anything overwhelming.
When a house of cards has outgrown its initial goal and view, and onlookers
are just confused what this is and how it relates to the old-time small
house they knew and loved, it is best to stop overloading this weird
creation, it is time to start from scratch and produce a new one, which
will be free of any admitted flaws of the previous design and not forced to
perpetuate them.
Thanks,
Dimitre
On Mon, Nov 23, 2020 at 12:17 PM Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]> wrote:
> doc("") only works if the static base URI of the (relevant part of the)
> stylesheet is known, and my guess here is that repeated building of the
> stylesheet in successive calls loses knowledge of the static base URI.
>
> It would be nice if we only compiled the stylesheet once when the same
> stylesheet-node is passed to fn:transform() repeatedly, but perhaps we're
> not being smart enough to do that.
>
> Having a stylesheet read it's own source code using doc("") is a pretty
> dreadful hack and really has no place in modern XSLT code. In the general
> case where compiled stylesheets are deployed around the world, the source
> code isn't available at execution time anyway.
>
> Michael Kay
> Saxonica
>
> On 23 Nov 2020, at 17:15, Ihe Onwuka <[email protected]> wrote:
>
> XTSE0150 The supplied file does not appear to be a stylesheet
> at function local:generateNextVersion in translator.xsl:
> invoked by function call
>
> I have
>
> <xsl:variable name="currentStylesheet" as="document-node()"
> select="doc('')"/>
>
> and then the recursive function
>
> <xsl:function name="local:generateNextVersion" as="document-node()">
> <xsl:param name="currentVersion" as="document-node()"/>
> <xsl:variable name="isFinalVersion" as="xs:boolean"
> select="namespace-uri($currentVersion/*) => contains($finalTarget)"/>
> <xsl:sequence select="if ($isFinalVersion)
> then $currentVersion
> else
> local:generateNextVersion(fn:transform(map {
>
> 'stylesheet-node' : $currentStylesheet,
>
> 'source-node' : $currentVersion
> })?output)"/>
> </xsl:function>
>
> This functions works through the first 2 recursion cycles. When I have a
> situation that would cause it to recurse a 3rd time the reported error
> shows up.
> Whatever is wrong with the program it cannot be what is being reported
> because the stylesheet node is being directly populated by doc('') and that
> doesn't magically stop being a recursive call to the current stylesheet
> after a set number of iterations.
>
>
> _______________________________________________
> 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
--
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