Skip to content

Commit

Permalink
fix matching for guidance/examples
Browse files Browse the repository at this point in the history
working on #12
  • Loading branch information
Benjamin Riesenberg committed Apr 20, 2024
1 parent e19793e commit 2c140de
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 26 deletions.
2 changes: 1 addition & 1 deletion xsl/functions.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<xsl:function name="cdmm:convert_object_type_notation">
<xsl:param name="cdm_object_type"/>
<xsl:choose>
<xsl:when test="$cdm_object_type = 'compound_object'">co</xsl:when>
<xsl:when test="$cdm_object_type = 'compound_object'">object</xsl:when>
<xsl:when test="$cdm_object_type = 'co_item'">item</xsl:when>
<xsl:when test="$cdm_object_type = 'standalone_item'">no</xsl:when>
</xsl:choose>
Expand Down
102 changes: 77 additions & 25 deletions xsl/xml_map_properties_files_to_html.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
! include file type extension -->
<xsl:param name="xml_map_filename"/>

<!-- GLOBAL VARS -->
<!-- global vars -->
<xsl:variable name="xml_map"
select="document(concat('../xml/', $xml_map_filename))/cdmm:xml_map"/>
<xsl:variable name="alias" select="$xml_map/cdmm:coll_alias"/>

<!-- INCLUDE functions, uwlib-cams/webviews -->
<!-- include -->
<xsl:include href="functions.xsl"/>
<xsl:include href="https://uwlib-cams.github.io/webviews/xsl/CC0-footer.xsl"/>
<xsl:include href="https://uwlib-cams.github.io/webviews/xsl/index-backlink.xsl"/>
Expand Down Expand Up @@ -389,31 +389,57 @@
</li>
</xsl:if>
<xsl:choose>
<!-- match custom guidance on all three @co, @dd, @genre_form -->
<xsl:when test="
schemas:descriptions/schemas:customization
[matches(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
matches(@co, 'all')]
[matches(@dd, $alias) or matches(@dd, '\*')]
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@dd, $alias) or contains(@dd, '*')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
matches(@genre_form, '\*')]">
contains(@genre_form, '*')]">
<xsl:for-each select="
schemas:descriptions/schemas:customization
[matches(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
matches(@co, 'all')]
[matches(@dd, $alias) or matches(@dd, '\*')]
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@dd, $alias) or contains(@dd, '*')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
matches(@genre_form, '\*')]
contains(@genre_form, '*')]
/schemas:para">
<li>{.}</li>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- match default guidance on @co -->
<xsl:for-each select="
schemas:descriptions/schemas:instructions
[matches(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
matches(@co, 'all')]
(: !? what about default guidance per genre_form!? :)">
<li>{.}</li>
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]">
<xsl:choose>
<!-- if a match for @co *and* @genre_form exists, use that default guidance -->
<xsl:when test=".
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
contains(@genre_form, '*')]">
<xsl:for-each select=".
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
contains(@genre_form, '*')]
/schemas:para">
<li>{.}</li>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- else, match default guidance on @co only -->
<xsl:for-each select=".
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
/schemas:para">
<li>{.}</li>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
Expand All @@ -425,30 +451,56 @@
<td>
<ul class="no_bullets">
<xsl:choose>
<!-- match custom examples on all three @co, @dd, @genre_form -->
<xsl:when test="
schemas:examples/schemas:customization
[matches(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
matches(@co, 'all')]
[matches(@dd, $alias) or matches(@dd, '\*')]
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@dd, $alias) or contains(@dd, '*')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
matches(@genre_form, '\*')]">
contains(@genre_form, '*')]">
<xsl:for-each select="
schemas:examples/schemas:customization
[matches(@co, cdmm:convert_object_type_notation($cdm_object_type))]
[matches(@dd, $alias) or matches(@dd, '\*')]
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type))]
[contains(@dd, $alias) or contains(@dd, '*')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
matches(@genre_form, '\*')]
contains(@genre_form, '*')]
/schemas:para">
<li>{.}</li>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- match default examples on @co -->
<xsl:for-each select="
schemas:examples/schemas:example
[matches(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
matches(@co, 'all')]
(: !? what about default examples per genre_form!? :)">
<li>{.}</li>
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]">
<xsl:choose>
<!-- if a match for @co *and* @genre_form exists, use those default examples -->
<xsl:when test=".
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
contains(@genre_form, '*')]">
<xsl:for-each select=".
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
[contains(@genre_form, $section/cdmm:section/cdmm:genre_form) or
contains(@genre_form, '*')]
/schemas:para">
<li>{.}</li>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- else, match default examples on @co only -->
<xsl:for-each select=".
[contains(@co, cdmm:convert_object_type_notation($cdm_object_type)) or
contains(@co, 'all')]
/schemas:para">
<li>{.}</li>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
Expand Down

0 comments on commit 2c140de

Please sign in to comment.