Skip to content

Commit

Permalink
ldh:base-uri uses base URI of the parent node for text and attribut…
Browse files Browse the repository at this point in the history
  • Loading branch information
namedgraph committed Oct 9, 2023
1 parent 7bab98b commit 65b14e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ exclude-result-prefixes="#all"
<xsl:function name="ldh:base-uri" as="xs:anyURI?">
<xsl:param name="arg" as="node()"/>

<xsl:sequence select="if (ixsl:contains($arg, 'baseURI')) then ac:document-uri(ixsl:get($arg, 'baseURI')) else ()"/>
<xsl:choose>
<xsl:when test="($arg instance of attribute()) or ($arg instance of text())">
<xsl:sequence select="if (ixsl:contains($arg/.., 'baseURI')) then ac:document-uri(ixsl:get($arg/.., 'baseURI')) else ()"/>
</xsl:when>
<xsl:otherwise>
<xsl:sequence select="if (ixsl:contains($arg, 'baseURI')) then ac:document-uri(ixsl:get($arg, 'baseURI')) else ()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>

<xsl:function name="ac:mode" as="xs:anyURI*">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,11 @@ 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?"/>
<!-- 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'"/>
<!-- 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 @@ -423,9 +422,8 @@ 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?"/>
<!-- 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 @@ -449,9 +447,8 @@ 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?"/>
<!-- 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 Down Expand Up @@ -511,8 +508,7 @@ 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'"/>
<!-- 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: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 65b14e0

Please sign in to comment.