[Saxon-JS 2] Callback template param value
Martynas Jusevičius <martynas-tyFqBaoSXPC1Z/[email protected]> Tue, 29 Sep 2020 13:04:19 +0200
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <CAE35Vmy6E9ZxsS6wc9nbgDN0hw7kkdDh7ph73R7GBgw=MLbk0w@mail.gmail.com> |
Hi,
I don't get how this happens -- why is the same param value passed to
the callback template when I would expect 3 different values?
<xsl:template>
...
<xsl:variable name="facet-bgps"
select="$select-xml//json:map[json:string[@key = 'type'] =
'bgp']/json:array[@key =
'triples']/json:map[not(starts-with(json:string[@key = 'predicate'],
'?'))][starts-with(json:string[@key = 'object'], '?')]"
as="element()*"/>
<xsl:for-each select="$facet-bgps">
<xsl:sort select="ac:property-label(json:string[@key = 'predicate'])"/>
<xsl:variable name="bgp" select="." as="element()"/>
...
<xsl:variable name="results-uri" select="..." as="xs:anyURI"/>
<xsl:message>
PREDICATE: <xsl:value-of select="$bgp/json:string[@key = 'predicate']"/>
</xsl:message>
<ixsl:schedule-action http-request="map{ 'method': 'GET',
'href': $results-uri, 'headers': map{ 'Accept':
'application/sparql-results+xml' } }">
<xsl:call-template name="onFacetValueResultsLoad">
<xsl:with-param name="container-id" select="$container-id"/>
<xsl:with-param name="bgp" select="$bgp"/>
</xsl:call-template>
</ixsl:schedule-action>
</xsl:for-each>
</xsl:template>
<xsl:template name="onFacetValueResultsLoad">
<xsl:context-item as="map(*)" use="required"/>
<xsl:param name="container-id" as="xs:string"/>
<xsl:param name="bgp" as="element()"/>
<xsl:message>
PREDICATE IN CALLBACK: <xsl:value-of select="$bgp/json:string[@key
= 'predicate']"/>
</xsl:message>
...
This is the output I get:
xsl:message:
PREDICATE: http://purl.uniprot.org/core/organism
xsl:message:
PREDICATE: http://purl.uniprot.org/core/encodedBy
xsl:message:
PREDICATE: http://www.w3.org/2000/01/rdf-schema#label
xsl:message:
PREDICATE IN CALLBACK: http://www.w3.org/2000/01/rdf-schema#label
xsl:message:
PREDICATE IN CALLBACK: http://www.w3.org/2000/01/rdf-schema#label
xsl:message:
PREDICATE IN CALLBACK: http://www.w3.org/2000/01/rdf-schema#label
3 different values in the calling template, the same 1 value in the
callback template.
How is that possible?
Martynas