Re: Faking primary ports?

Dear xproc-dev, (cc Gerrit, Martin),

Thank you, Gerrit and Martin, for the quick respones. Here's the result:

Omitting the declaration of the primary ports is fine as long as I don't
have a top-level <p:identity>, which I was using to output messages to
stderr, and which was the source of my earlier errors. This is obvious ( I
can't perform an identity step on a source that doesn't exist), except that
it wasn't (sigh; user inexperience). I can hang @message on <p:xslt>, so
not only is not being able to use a top-level <p:identity> step just for
messaging not a problem, but the version without <p:identity>, and with
the @message on <p:xslt> instead, is clearer and more concise.

Using <p:xslt template-name="xsl:initial-template"> and a named template
with that name (or another name) lets me omit the specification of a source
port (or implicit, pipelined source) for an XSLT step. I do have to specify
the name of the initial template in the XProc (and add the namespace prefix
binding), even where that name is "xsl:initial-template", which is the
default name for an initial template in a pure XSLT context.

Thanks again,

David


On Wed, Sep 9, 2020 at 2:06 AM Imsieke, Gerrit, le-tex <
gerrit.imsieke@le-tex.de> wrote:

> I haven’t tried what happens if you invoke <p:xslt
> template-name="xsl:initial-template"/>. It might just work, or it might
> not.
>
> On 09.09.2020 08:01, Imsieke, Gerrit, le-tex wrote:
> > You can specify an initial template with <p:xslt template-name="…">. I’m
> > not sure whether you can use the template designated as
> > xsl:initial-template in XProc though. You’d need to supply an empty
> > sequence or an empty string to the template-name option. Supplying an
> > empty sequence is tantamount to not setting the option at all, so I
> > don’t think that the processor can see a difference between supplying an
> > empty sequence and no template-name option provided at all. On the other
> > hand, if you explicitly supply an empty string using <p:with-option
> > name="template-name" select="''"/>, it will try to cast this empty
> > string to an xs:QName, which will fail. So I recommend that you use a
> > named template with a name that is not xsl:initial-template.
>
>

Received on Wednesday, 9 September 2020 15:13:04 UTC