Skip to content

Commit

Permalink
Use the parent's baseURI because in the browser this property is unde…
Browse files Browse the repository at this point in the history
…fined for attributes
  • Loading branch information
namedgraph committed Oct 9, 2023
1 parent d6c91b6 commit 7bab98b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ extension-element-prefixes="ixsl"
exclude-result-prefixes="#all"
>

<!-- <xsl:function name="ldh:href" as="xs:anyURI">
<xsl:sequence select="xs:anyURI(ixsl:get(ixsl:window(), 'location.href'))"/>
</xsl:function>-->

<xsl:function name="ldt:base" as="xs:anyURI">
<xsl:sequence select="xs:anyURI(ixsl:get(ixsl:window(), 'LinkedDataHub.base'))"/>
</xsl:function>
Expand All @@ -47,10 +43,6 @@ exclude-result-prefixes="#all"

<xsl:sequence select="if (ixsl:contains($arg, 'baseURI')) then ac:document-uri(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>-->

<xsl:function name="ac:mode" as="xs:anyURI*">
<xsl:param name="base-uri" as="xs:anyURI"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,12 @@ exclude-result-prefixes="#all"
<xsl:param name="endpoint" as="xs:anyURI?" tunnel="yes"/>
<xsl:param name="query-string" select="'DESCRIBE &lt;' || . || '&gt;'" as="xs:string"/>
<xsl:param name="fragment" select="if (starts-with(., $ldt:base)) then (if (contains(., '#')) then substring-after(., '#') else ()) else encode-for-uri(.)" as="xs:string?"/>
<xsl:message use-when="system-property('xsl:product-name') eq 'SaxonJS'">111 ldh:base-uri(.): <xsl:value-of select="ldh:base-uri(.)"/> ldh:base-uri(..): <xsl:value-of select="ldh:base-uri(..)"/></xsl:message>
<!--
<!-- use the parent's baseURI because in the browser this property is undefined for attributes -->
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(base-uri()), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(ldh:base-uri(.)), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
!!!!!!!!!!!!! - if the URI's absolute path equals the current URL and has a #fragment, use the fragment as @id. Otherwise use encoded URI as @id. -
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(ldh:base-uri(..)), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<!-- if the URI's absolute path equals the current URL and has a #fragment, use the fragment as @id. Otherwise use encoded URI as @id. -->
<xsl:param name="id" select="if (starts-with(., '#') or (ldh:absolute-path(.) = ldh:absolute-path(base-uri()) and (contains(., '#')))) then substring-after(., '#') else (if (starts-with(., $ldt:base)) then () else encode-for-uri(.))" as="xs:string?" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<xsl:param name="id" select="if (starts-with(., '#') or (ldh:absolute-path(.) = ldh:absolute-path(ldh:base-uri(.)) and (contains(., '#')))) then substring-after(., '#') else (if (starts-with(., $ldt:base)) then () else encode-for-uri(.))" as="xs:string?" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<xsl:param name="id" select="if (starts-with(., '#') or (ldh:absolute-path(.) = ldh:absolute-path(ldh:base-uri(..)) and (contains(., '#')))) then substring-after(., '#') else (if (starts-with(., $ldt:base)) then () else encode-for-uri(.))" as="xs:string?" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>

<xsl:param name="title" select="." as="xs:string?"/>
<xsl:param name="class" as="xs:string?"/>
Expand All @@ -418,17 +417,15 @@ exclude-result-prefixes="#all"
<xsl:with-param name="class" select="$class"/>
<xsl:with-param name="target" select="$target"/>
</xsl:next-match>
-->
</xsl:template>

<xsl:template match="@rdf:about | @rdf:resource" mode="svg:Anchor">
<xsl:param name="endpoint" as="xs:anyURI?" tunnel="yes"/>
<xsl:param name="query-string" select="'DESCRIBE &lt;' || . || '&gt;'" as="xs:string"/>
<xsl:param name="fragment" select="if (starts-with(., $ldt:base)) then (if (contains(., '#')) then substring-after(., '#') else ()) else encode-for-uri(.)" as="xs:string?"/>
<xsl:message use-when="system-property('xsl:product-name') eq 'SaxonJS'">222 ldh:base-uri(.): <xsl:value-of select="ldh:base-uri(.)"/> ldh:base-uri(..): <xsl:value-of select="ldh:base-uri(..)"/></xsl:message>
<!--
<!-- use the parent's baseURI because in the browser this property is undefined for attributes -->
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(base-uri()), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(ldh:base-uri(.)), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(ldh:base-uri(..)), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<xsl:param name="id" select="$fragment" as="xs:string?"/>
<xsl:param name="label" select="if (parent::rdf:Description) then ac:svg-label(..) else ac:svg-object-label(.)" as="xs:string"/>
<xsl:param name="title" select="$label" as="xs:string"/>
Expand All @@ -443,7 +440,6 @@ exclude-result-prefixes="#all"
<xsl:with-param name="class" select="$class"/>
<xsl:with-param name="target" select="$target"/>
</xsl:next-match>
-->
</xsl:template>

<!-- DEFAULT -->
Expand All @@ -453,10 +449,9 @@ exclude-result-prefixes="#all"
<xsl:param name="endpoint" as="xs:anyURI?" tunnel="yes"/>
<xsl:param name="query-string" select="'DESCRIBE &lt;' || . || '&gt;'" as="xs:string"/>
<xsl:param name="fragment" select="if (starts-with(., $ldt:base)) then (if (contains(., '#')) then substring-after(., '#') else ()) else encode-for-uri(.)" as="xs:string?"/>
<xsl:message use-when="system-property('xsl:product-name') eq 'SaxonJS'">333 ldh:base-uri(.): <xsl:value-of select="ldh:base-uri(.)"/> ldh:base-uri(..): <xsl:value-of select="ldh:base-uri(..)"/></xsl:message>
<!--
<!-- use the parent's baseURI because in the browser this property is undefined for attributes -->
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(base-uri()), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(ldh:base-uri(.)), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<xsl:param name="href" select="ldh:href($ldt:base, ldh:absolute-path(ldh:base-uri(..)), map{}, if ($endpoint) then xs:anyURI($endpoint || '?query=' || encode-for-uri($query-string)) else xs:anyURI(.), $fragment)" as="xs:anyURI" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<xsl:param name="id" as="xs:string?"/>
<xsl:param name="title" select="." as="xs:string?"/>
<xsl:param name="class" as="xs:string?"/>
Expand All @@ -469,7 +464,6 @@ exclude-result-prefixes="#all"
<xsl:with-param name="class" select="$class"/>
<xsl:with-param name="target" select="$target"/>
</xsl:next-match>
-->
</xsl:template>

<!-- LOOKUP -->
Expand Down Expand Up @@ -517,7 +511,8 @@ exclude-result-prefixes="#all"
<xsl:param name="disabled" select="false()" as="xs:boolean"/>
<xsl:param name="auto" select="local-name() = 'nodeID' or starts-with(., $ldt:base)" as="xs:boolean"/>
<xsl:param name="base-uri" select="base-uri()" as="xs:anyURI" tunnel="yes" use-when="system-property('xsl:product-name') = 'SAXON'"/>
<xsl:param name="base-uri" select="ldh:base-uri(.)" as="xs:anyURI" tunnel="yes" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>
<!-- use the parent's baseURI because in the browser this property is undefined for attributes -->
<xsl:param name="base-uri" select="ldh:base-uri(..)" as="xs:anyURI" tunnel="yes" use-when="system-property('xsl:product-name') eq 'SaxonJS'"/>

<xsl:choose>
<xsl:when test="not($type = 'hidden')">
Expand Down

0 comments on commit 7bab98b

Please sign in to comment.