Skip to content

Commit

Permalink
Migrate check for Locations that don't start with https://
Browse files Browse the repository at this point in the history
  • Loading branch information
iay committed May 11, 2009
1 parent 370abc5 commit 3df320b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
17 changes: 17 additions & 0 deletions build/check.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@
</xsl:call-template>
</xsl:template>


<!--
Check for Locations that don't start with https://
This may be a little strict, and might be better confined to md:* elements.
In addition, we might at some point require more complex rules: whitelisting certain
entities, or permitting http:// to Locations associated with certain bindngs.
At present, however, this simpler rule produces no false positives.
-->
<xsl:template match="*[@Location and not(starts-with(@Location,'https://'))]">
<xsl:call-template name="fatal">
<xsl:with-param name="m"><xsl:value-of select='local-name()'/> Location does not start with https://</xsl:with-param>
</xsl:call-template>
</xsl:template>


<!--
Common template to call to report a fatal error on some element within an entity.
-->
Expand Down
23 changes: 1 addition & 22 deletions build/statistics.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@
at the start so that we can include or exclude the associated section.
-->

<!-- Locations that don't start with https:// -->
<xsl:variable name="prob.nohttps.location.exceptions"
select="$entities[@entityID='no.such.entity']"/>
<xsl:variable name="prob.nohttps.location.entities"
select="set:difference($entities, $prob.nohttps.location.exceptions)"/>
<xsl:variable name="prob.nohttps.location"
select="$prob.nohttps.location.entities[descendant::*[@Location and not(starts-with(@Location,'https://'))]]"/>

<!-- duplicate entity IDs -->
<xsl:variable name="prob.distinct.entityIDs" select="set:distinct($entities/@entityID)"/>
<xsl:variable name="prob.dup.entityID"
Expand All @@ -115,8 +107,7 @@
<xsl:variable name="prob.unowned.entities" select="set:difference($entities, $ownedEntities)"/>

<!-- all problems, used as a conditional -->
<xsl:variable name="prob.all" select="$prob.nohttps.location |
$prob.dup.entityID |
<xsl:variable name="prob.all" select="$prob.dup.entityID |
$prob.dup.ODNs |
$prob.unowned.entities"/>
<xsl:variable name="prob.count" select="count($prob.all)"/>
Expand Down Expand Up @@ -149,18 +140,6 @@
-->
<xsl:if test="$prob.count != 0">
<h2><a name="problems">Metadata Problems</a></h2>
<xsl:if test="count($prob.nohttps.location) != 0">
<p>The following entities include elements with <code>Location</code> attributes
that don't start with <code>https://</code>:</p>
<ul>
<xsl:for-each select="$prob.nohttps.location">
<li>
<xsl:value-of select="@ID"/>:
<code><xsl:value-of select="@entityID"/></code>
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="count($prob.dup.entityID) != 0">
<p>The following entity names are used by more than one entity:</p>
<ul>
Expand Down

0 comments on commit 3df320b

Please sign in to comment.