Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide function for determining the URI that a given output port will serialize to #35

Open
gimsieke opened this issue Apr 19, 2023 · 1 comment

Comments

@gimsieke
Copy link

While the connection of an output port to an external document is implementation-defined, it may make sense to provide an interoperable function to query the URI that an output port will be written to by the processor, if the port is connected to a document on invocation.

A use case is: Write the primary output to a document that contains xi:include instructions using the implementation-defined way (-o result=uri for XML Calabash) and to use p:store in order to write the files-to-be-xincluded to a location that is relative to the primary output location. Currently you cannot find out the output port’s destination document URI within the pipeline, therefore you cannot compute relative locations for p:store/@href.

Such a thing, to my knowledge, can currently only achieved if the user specifies an output URI as a pipeline option, instead of writing the primary output to a certain document upon invocation. This output URI can then be used to write all outputs, both the top-level document that contains the XIncludes and the xincluded secondary documents, via p:store.

We can introduce a function p:output-uri($port as xs:string) → xs:anyURI?, where port is, for example, 'result'. If no serialization is requested (in an implementation-defined way), the empty sequence will be returned. If no output port with such a name is declared on the closest containing p:declare-step, a static error will be raised.

So far we don’t have functions that accept port names AFAIK, but this should be doable, shouldn’t it?

@gimsieke
Copy link
Author

It can be useful for a p:declare-step that is contained in another p:declare-step to query an output port connection URI of an outer p:declare-step. Therefore p:output-uri('result@outer-step') should also be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant