Feature #6355
closedA new instruction that makes a document available by the document() function
100%
Description
ixsl:schedule-action
supports @document
and @http-request
. Both approaches have their advantages.
For @schedule-action
:
The called template can access the documents using the
doc()
,document()
,doc-available()
,json-doc()
,unparsed-text()
,unparsed-text-available()
, andunparsed-text-lines()
functions as appropriate (the documents will be found in a local cache and will not involve another request to the server).
For @http-request
it's the possibility to fully specify the HTTP request headers. That's what I have been using so har
The problem is that the approaches cannot be combined. In other words, it is not possible to specify HTTP request headers, load documents asynchronously and pass them to templates that use document() What could be the solution to this?
Adding more options to ixsl:schedule-action
seems like it would overload the instruction too much. I'm thinking a better idea could be decoupling the HTTP client functionality from the document caching functionality. That could be achieved using a new instruction that caches a document node under the specified URI, thus making it available for document()
calls.
For example:
<xsl:variable name="href" select="http://example.com/doc.xml" as="xs:string"/>
<ixsl:schedule-action http-request="map{ 'href': $href }">
<xsl:call-template name="response-callback">
<xsl:with-param name="href" select="$href"/>
</xsl:call-template>
</ixsk:schedule-action>
<xsl:template name="response-callback">
<xsl:param name="href" as="xs:string"/>
<ixsl:cache-doc href="$href" select="?body"/>
<xsl:call-template name="legacy"/>
</xsl:template>
<xsl:template name="legacy">
<xsl:message select="document('http://example.com/doc.xml')"/> <!-- retrieved from cache -->
</xsl:template>
Please register to edit this issue
Also available in: Atom PDF Tracking page