Skip to content

Commit

Permalink
Remove with-parent-controls from implementation (#1843)
Browse files Browse the repository at this point in the history
* Remove with-parent-controls from XSLT profile resolver for #1816.

* Remove profile resolver with-parent-controls tests for #1816.
  • Loading branch information
aj-stein-nist authored and Chris Compton committed Dec 6, 2023
1 parent 7c47f23 commit e36c374
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 213 deletions.
13 changes: 0 additions & 13 deletions src/utils/resolver-pipeline/select-or-custom-merge.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,20 @@
<xsl:sequence select="exists($importing/include-all)"/>
<xsl:sequence select="some $c in ($importing/include-controls/with-id)
satisfies ($c = $candidate/@id)"/>
<xsl:sequence select="some $c in ($importing/include-controls[o:calls-parents(.)]/with-id)
satisfies ($c = $candidate/descendant::control/@id)"/>
<xsl:sequence select="some $c in ($importing/include-controls[o:calls-children(.)]/with-id)
satisfies ($c = $candidate/ancestor::control/@id)"/>
<xsl:sequence select="some $m in ($importing/include-controls/matching[@pattern != ''])
satisfies (matches($candidate/@id,$m/@pattern/o:glob-as-regex(string(.)) ))"/>
<xsl:sequence select="some $m in ($importing/include-controls[o:calls-parents(.)]/matching[@pattern != '']), $a in $candidate/descendant::control
satisfies (matches($a/@id,$m/@pattern/o:glob-as-regex(string(.))))"/>
<xsl:sequence select="some $m in ($importing/include-controls[o:calls-children(.)]/matching[@pattern != '']), $a in $candidate/ancestor::control
satisfies (matches($a/@id,$m/@pattern/o:glob-as-regex(string(.))))"/>
</xsl:variable>
<xsl:variable name="exclude-reasons" as="xs:boolean+">
<xsl:sequence select="exists($candidate/parent::control) and $importing/include-all/@with-child-controls='no'"/>
<xsl:sequence select="some $c in ($importing/exclude-controls/with-id) satisfies ($c = $candidate/@id)"/>
<xsl:sequence select="some $c in ($importing/exclude-controls[o:calls-parents(.)]/with-id)
satisfies ($c = $candidate/descendant::control/@id)"/>
<xsl:sequence select="some $c in ($importing/exclude-controls[o:calls-children(.)]/with-id)
satisfies ($c = $candidate/ancestor::control/@id)"/>
<xsl:sequence select="some $m in ($importing/exclude-controls/matching[@pattern != ''])
satisfies (matches($candidate/@id,$m/@pattern/o:glob-as-regex(string(.))))"/>
<xsl:sequence select="some $m in ($importing/exclude-controls[o:calls-parents(.)]/matching[@pattern != '']), $a in $candidate/descendant::control
satisfies (matches($a/@id,$m/@pattern/o:glob-as-regex(string(.))))"/>
<xsl:sequence select="some $m in ($importing/exclude-controls[o:calls-children(.)]/matching[@pattern != '']), $a in $candidate/ancestor::control
satisfies (matches($a/@id,$m/@pattern/o:glob-as-regex(string(.))))"/>
</xsl:variable>
Expand All @@ -84,11 +76,6 @@
<xsl:param name="caller" as="element()"/>
<xsl:sequence select="$caller/@with-child-controls='yes'"/>
</xsl:function>

<xsl:function name="o:calls-parents" as="xs:boolean">
<xsl:param name="caller" as="element()"/>
<xsl:sequence select="not($caller/@with-parent-controls='no')"/>
</xsl:function>

<xsl:function name="opr:catalog-identifier" as="xs:string">
<xsl:param name="catalog" as="element(o:catalog)"/>
Expand Down
200 changes: 0 additions & 200 deletions src/utils/resolver-pipeline/testing/1_selected/select.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -292,40 +292,6 @@
</profile>
</x:expect>
</x:scenario>

<x:scenario label="Default value of 'with-parent-controls' (yes)">
<x:context>
<profile>
<import href="{$ov:filedir}/catalogs/xyz-tiny_catalog.xml">
<include-controls with-parent-controls="yes">
<with-id>z3.a-1</with-id>
</include-controls>
</import>
</profile>
</x:context>

<x:expect label="Control Z3-A-1 and all its ancestors">
<profile>
<selection uuid="..." opr:src="...">
<metadata>...</metadata>
<group opr:id="...">
<title>Group X of XYZ</title>
</group>
<group opr:id="...">
<title>Group Y of XYZ</title>
</group>
<group opr:id="...">
<title>Group Z of XYZ</title>
<control id="z3" opr:id="..."><title>Control Z3</title>
<control id="z3.a" opr:id="..."><title>Control Z3-A</title>
<control id="z3.a-1" opr:id="..."><title>Control Z3-A-1</title></control>
</control>
</control>
</group>
</selection>
</profile>
</x:expect>
</x:scenario>

<x:scenario label="Nondefault value of 'with-parent-controls' (no)">
<x:context>
Expand Down Expand Up @@ -800,32 +766,6 @@
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>
<x:scenario label="Select descendant ID, omitting with-parent-controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-controls>
<with-id>level-four</with-id>
</include-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="true (with-parent-controls defaults to yes)" select="true()"/>
</x:scenario>
<x:scenario label="Select descendant ID, and explicitly include parent controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-controls with-parent-controls="yes">
<with-id>level-four</with-id>
</include-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="Select descendant ID and do not include parent controls.">
<x:call function="o:selects">
<x:param name="importing">
Expand Down Expand Up @@ -938,32 +878,6 @@
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>
<x:scenario label="Match descendant ID, omitting with-parent-controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-controls>
<matching pattern="*-four"/>
</include-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="true (with-parent-controls defaults to yes)" select="true()"/>
</x:scenario>
<x:scenario label="Match descendant ID, with parent controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-controls with-parent-controls="yes">
<matching pattern="*-four"/>
</include-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="Match descendant ID, without parent controls.">
<x:call function="o:selects">
<x:param name="importing">
Expand Down Expand Up @@ -1016,23 +930,6 @@
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>
<x:scenario label="Include grandchild with parent controls, and include child without parent controls">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-controls with-parent-controls="yes">
<with-id>level-four</with-id>
</include-controls>
<include-controls with-parent-controls="no">
<with-id>level-three</with-id>
</include-controls>
</import>
</x:param>
<x:param name="candidate"
select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="Include grandparent with child controls, and include parent without child controls">
<x:call function="o:selects">
<x:param name="importing">
Expand Down Expand Up @@ -1095,48 +992,6 @@
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="Exclude descendant ID, omitting with-parent-controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-all/>
<exclude-controls>
<with-id>level-four</with-id>
</exclude-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="false (with-parent-controls defaults to yes)" select="false()"/>
</x:scenario>
<x:scenario label="Exclude descendant ID with parent controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-all/>
<exclude-controls with-parent-controls="yes">
<with-id>level-four</with-id>
</exclude-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>
<x:scenario label="Exclude descendant ID without parent controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-all/>
<exclude-controls with-parent-controls="no">
<with-id>level-four</with-id>
</exclude-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="Exclude ancestor ID, omitting with-child-controls.">
<x:call function="o:selects">
<x:param name="importing">
Expand Down Expand Up @@ -1277,34 +1132,6 @@
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="Match descendant ID, omitting with-parent-controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-all/>
<exclude-controls>
<matching pattern="*-four"/>
</exclude-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="false (with-parent-controls defaults to yes)" select="false()"/>
</x:scenario>
<x:scenario label="Match descendant ID, with parent controls.">
<x:call function="o:selects">
<x:param name="importing">
<import>
<include-all/>
<exclude-controls with-parent-controls="yes">
<matching pattern="*-four"/>
</exclude-controls>
</import>
</x:param>
<x:param name="candidate" select="$ov:control-hierarchy//o:control[@id='level-two']"/>
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>
<x:scenario label="Match descendant ID, without parent controls.">
<x:call function="o:selects">
<x:param name="importing">
Expand Down Expand Up @@ -1468,33 +1295,6 @@
</x:scenario>
</x:scenario>

<x:scenario label="Tests for o:calls-parents function">
<x:scenario label="with-parent-controls attribute is 'yes'">
<x:call function="o:calls-parents">
<x:param>
<elem with-parent-controls="yes"/>
</x:param>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
<x:scenario label="with-parent-controls attribute is 'no'">
<x:call function="o:calls-parents">
<x:param>
<elem with-parent-controls="no"/>
</x:param>
</x:call>
<x:expect label="false" select="false()"/>
</x:scenario>
<x:scenario label="with-parent-controls attribute is omitted">
<x:call function="o:calls-parents">
<x:param>
<elem/>
</x:param>
</x:call>
<x:expect label="true" select="true()"/>
</x:scenario>
</x:scenario>

<x:scenario label="Tests for o:resource-or-error function">
<x:scenario label="Document is available">
<x:call function="o:resource-or-error">
Expand Down

0 comments on commit e36c374

Please sign in to comment.