Skip to content

Commit 59ef15d

Browse files
galtmaj-stein-nist
authored andcommitted
Compatibility with Saxon 10 and 11 (#1685)
Replace document-uri with base-uri. Saxon 10 and 11 can return different values from document-uri() function. For compatibility and to avoid errors when document-uri() returns empty with Saxon 11, use base-uri() instead.
1 parent b267c6a commit 59ef15d

File tree

8 files changed

+10
-11
lines changed

8 files changed

+10
-11
lines changed

src/utils/util/resolver-pipeline/oscal-profile-RESOLVE.xsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
Each represents a stage in processing.
6868
The result of each processing step is passed to the next step as its input, until no steps are left. -->
6969
<xsl:call-template name="alert">
70-
<xsl:with-param name="msg" expand-text="yes"> RESOLVING PROFILE { document-uri($source) } </xsl:with-param>
70+
<xsl:with-param name="msg" expand-text="yes"> RESOLVING PROFILE { base-uri($source) } </xsl:with-param>
7171
</xsl:call-template>
7272
<xsl:iterate select="$transformation-sequence/*">
7373
<xsl:param name="doc" select="$source" as="document-node()"/>
@@ -98,9 +98,9 @@
9898
<xsl:variable name="xslt-spec" select="."/>
9999
<xsl:variable name="runtime-params" as="map(xs:QName,item()*)">
100100
<xsl:map>
101-
<xsl:map-entry key="QName('','profile-origin-uri')" select="document-uri($home)"/>
101+
<xsl:map-entry key="QName('','profile-origin-uri')" select="base-uri($home)"/>
102102
<xsl:map-entry key="QName('','path-to-source')" select="$path-to-source"/>
103-
<xsl:map-entry key="QName('','uri-stack-in')" select="($uri-stack, document-uri($home))"/>
103+
<xsl:map-entry key="QName('','uri-stack-in')" select="($uri-stack, base-uri($home))"/>
104104
<xsl:apply-templates select="." mode="opr:provide-parameters"/>
105105
</xsl:map>
106106
</xsl:variable>

src/utils/util/resolver-pipeline/oscal-profile-resolve-metadata.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
</xsl:if>
121121
</xsl:for-each>
122122
<!-- Return the version from the source parameter. -->
123-
<xsl:value-of select="$source"/>
123+
<xsl:sequence select="$source"/>
124124
</xsl:function>
125125

126126
<!--<xsl:template match="selection" mode="imported-metadata">

src/utils/util/resolver-pipeline/oscal-profile-resolve-modify.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<!-- condition not(@by-id != $id) includes any addition without an @by-id, or whose @by-id is the control id -->
9090
<xsl:variable name="implicit-patches-to-id" select="$modifications/key('alteration-for-control-id',$id,.)/add[not(@by-id != $id)]" as="element(add)*"/>
9191

92-
<xsl:copy-of select="$patches-to-id-targeting-ancestor[@position = 'before']/*"/><xsl:message>got here! removable is <xsl:sequence select="oscal:removable(./*[1],$modifications)"/></xsl:message>
92+
<xsl:copy-of select="$patches-to-id-targeting-ancestor[@position = 'before']/*"/>
9393
<xsl:if test="not(ancestor::control and oscal:removable(.,$modifications))">
9494
<xsl:copy>
9595
<xsl:copy-of select="@*"/>

src/utils/util/resolver-pipeline/oscal-profile-resolve-select.xsl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@
7070
</xsl:template>
7171

7272
<xsl:template match="catalog" mode="o:select">
73-
<selection opr:src="{document-uri(root())}">
73+
<selection opr:src="{base-uri(root())}">
7474
<xsl:copy-of select="@* except @xsi:*" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
75-
<!--<xsl:attribute name="opr:base" select="document-uri(root())"/>-->
7675
<xsl:apply-templates mode="#current"/>
7776
</selection>
7877
</xsl:template>

src/utils/util/resolver-pipeline/random-util.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ v4 UUID
3030
<!-- Set $germ to a string for reproducible outputs of r:make-uuid.
3131
Pass in a blind value - and don't save it - for irreproducible outputs. -->
3232

33-
<xsl:param name="germ" select="current-dateTime() || document-uri(/)"/>
33+
<xsl:param name="germ" select="current-dateTime() || base-uri(/)"/>
3434

3535
<!-- for testing random number features -->
3636
<xsl:template match="/" name="xsl:initial-template" expand-text="true">

src/utils/util/resolver-pipeline/select-or-custom-merge.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
<xsl:function name="opr:catalog-identifier" as="xs:string">
9393
<xsl:param name="catalog" as="element(o:catalog)"/>
94-
<xsl:sequence select="$catalog/(@uuid,document-uri(root(.)))[1]"/>
94+
<xsl:sequence select="$catalog/(@uuid,base-uri(root(.)))[1]"/>
9595
</xsl:function>
9696

9797
</xsl:stylesheet>

src/utils/util/resolver-pipeline/testing/1_selected/select.xspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@
673673
<x:call function="opr:catalog-identifier">
674674
<x:param href="catalog-no-uuid.xml" select="/o:catalog"/>
675675
</x:call>
676-
<x:expect label="Returns document URI of catalog" test="ends-with($x:result,'/catalog-no-uuid.xml')"/>
676+
<x:expect label="Returns base URI of catalog" test="ends-with($x:result,'/catalog-no-uuid.xml')"/>
677677
</x:scenario>
678678
</x:scenario>
679679

src/utils/util/resolver-pipeline/testing/2_metadata/random-util.xspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
xslt-version="3.0">
99

1010
<!-- For repeatable testing, use a fixed germ. Also, XSpec
11-
cannot evaluate document-uri(/) in the default parameter
11+
cannot evaluate base-uri(/) in the default parameter
1212
value from the XSLT. -->
1313
<x:param name="germ">x</x:param>
1414

0 commit comments

Comments
 (0)