Skip to content

Commit

Permalink
ldh:base-uri function
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Oct 8, 2023
1 parent 428f5fd commit 10d6f84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ exclude-result-prefixes="#all"
<xsl:sequence select="xs:anyURI(ixsl:get(ixsl:window(), 'LinkedDataHub.base'))"/>
</xsl:function>

<!-- TO-DO: replace with standard XPath `base-uri` after this is fixed: -->
<xsl:function name="ldh:base-uri" as="xs:anyURI?">
<xsl:param name="arg" as="node()"/>

<xsl:sequence select="if (ixsl:contains($arg, 'baseURI')) then ixsl:get($arg, 'baseURI') else ()"/>
</xsl:function>

<xsl:function name="ac:uri" as="xs:anyURI">
<xsl:sequence select="xs:anyURI(ixsl:get(ixsl:window(), 'LinkedDataHub.uri'))"/>
</xsl:function>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,10 @@ WHERE
</xsl:if>

<xsl:for-each select="?body">
<xsl:message>RDF BASE URI: <xsl:value-of select="base-uri()"/></xsl:message>
<xsl:message>RDF base-uri(?body): <xsl:value-of select="base-uri()"/></xsl:message>
<xsl:message>RDF base-uri(ixsl:page()): <xsl:value-of select="ixsl:page()"/></xsl:message>
<xsl:message>RDF ldh:base-uri(?body): <xsl:value-of select="ldh:base-uri(.)"/></xsl:message>
<xsl:message>RDF ldh:base-uri(ixsl:page()): <xsl:value-of select="ldh:base-uri(ixsl:page())"/></xsl:message>

<xsl:variable name="results" select="." as="document-node()"/>
<ixsl:set-property name="{'`' || $uri || '`'}" select="ldh:new-object()" object="ixsl:get(ixsl:window(), 'LinkedDataHub.contents')"/>
Expand Down Expand Up @@ -898,7 +901,10 @@ WHERE

<ixsl:set-style name="cursor" select="'default'" object="ixsl:page()//body"/>

<xsl:message>HTML BASE URI: <xsl:value-of select="base-uri()"/></xsl:message>
<xsl:message>HTML base-uri(.): <xsl:value-of select="base-uri()"/></xsl:message>
<xsl:message>HTML ldh:base-uri(.): <xsl:value-of select="ldh:base-uri(.)"/></xsl:message>
<xsl:message>HTML ldh:base-uri(ixsl:page()): <xsl:value-of select="ldh:base-uri(ixsl:page())"/></xsl:message>

<ixsl:set-property name="uri" select="$uri" object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>
<xsl:if test="$endpoint">
<ixsl:set-property name="endpoint" select="$endpoint" object="ixsl:get(ixsl:window(), 'LinkedDataHub')"/>
Expand Down

0 comments on commit 10d6f84

Please sign in to comment.