Skip to content

Commit

Permalink
Duplicate check_framework in /mdx/ and change the checking rulesets t…
Browse files Browse the repository at this point in the history
…here to point to that. This will make it easier to move the other rulesets across from /build/.
  • Loading branch information
iay committed Dec 12, 2012
1 parent d3ed366 commit 8cc8fe2
Show file tree
Hide file tree
Showing 15 changed files with 142 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mdx/check_bindings.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

<xsl:template match="md:ArtifactResolutionService
[@Binding != 'urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding']
Expand Down
128 changes: 128 additions & 0 deletions mdx/check_framework.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
check_framework.xsl
XSL stylesheet providing a framework for use by rule checking files.
Author: Ian A. Young <ian@iay.org.uk>
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!--
The stylesheet output will be a text file, which will probably be thrown
away in any case. The real output from the check is sent using the
xsl:message element.
-->
<xsl:output method="text"/>


<!--
Common template to call to report an error on some element within an entity.
-->
<xsl:template name="error">
<xsl:param name="m"/>
<xsl:variable name="entity" select="ancestor-or-self::md:EntityDescriptor"/>
<xsl:message terminate='no'>
<xsl:text>[ERROR] </xsl:text>
<!--
If we're processing an aggregate, we need to indicate which
individual entity we're dealing with.
-->
<xsl:if test="ancestor-or-self::md:EntitiesDescriptor">
<!--
Use an ID if available, otherwise the entityID.
-->
<xsl:choose>
<xsl:when test="$entity/@ID">
<xsl:value-of select="$entity/@ID"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entity/@entityID"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="$m"/>
</xsl:message>
</xsl:template>


<!--
Common template to call to report a warning on some element within an entity.
-->
<xsl:template name="warning">
<xsl:param name="m"/>
<xsl:variable name="entity" select="ancestor-or-self::md:EntityDescriptor"/>
<xsl:message terminate='no'>
<xsl:text>[WARN] </xsl:text>
<!--
If we're processing an aggregate, we need to indicate which
individual entity we're dealing with.
-->
<xsl:if test="ancestor-or-self::md:EntitiesDescriptor">
<!--
Use an ID if available, otherwise the entityID.
-->
<xsl:choose>
<xsl:when test="$entity/@ID">
<xsl:value-of select="$entity/@ID"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entity/@entityID"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="$m"/>
</xsl:message>
</xsl:template>


<!--
Common template to call to report an informational message on some element within an entity.
-->
<xsl:template name="info">
<xsl:param name="m"/>
<xsl:variable name="entity" select="ancestor-or-self::md:EntityDescriptor"/>
<xsl:message terminate='no'>
<xsl:text>[INFO] </xsl:text>
<!--
If we're processing an aggregate, we need to indicate which
individual entity we're dealing with.
-->
<xsl:if test="ancestor-or-self::md:EntitiesDescriptor">
<!--
Use an ID if available, otherwise the entityID.
-->
<xsl:choose>
<xsl:when test="$entity/@ID">
<xsl:value-of select="$entity/@ID"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$entity/@entityID"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>: </xsl:text>
</xsl:if>
<xsl:value-of select="$m"/>
</xsl:message>
</xsl:template>


<!-- Recurse down through all elements by default. -->
<xsl:template match="*">
<xsl:apply-templates select="node()|@*"/>
</xsl:template>


<!-- Discard text blocks, comments and attributes by default. -->
<xsl:template match="text()|comment()|@*">
<!-- do nothing -->
</xsl:template>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_0.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_1.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

<!--
Check for SAML 2.0 SPs with KeyName-only KeyDescriptors.
Expand Down
2 changes: 1 addition & 1 deletion mdx/check_future_2.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

<!--
Check for entities which have both PKIX-only KeyDescriptors (i.e.,
Expand Down
2 changes: 1 addition & 1 deletion mdx/check_future_3.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>


</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_4.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_5.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_6.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_7.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>


</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_8.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>


</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_future_9.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>


</xsl:stylesheet>
2 changes: 1 addition & 1 deletion mdx/check_hoksso.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

<!--
Schema checks.
Expand Down
2 changes: 1 addition & 1 deletion mdx/check_regauth.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

<!--
expectedAuthority
Expand Down
2 changes: 1 addition & 1 deletion mdx/check_regscope.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!--
Common support functions.
-->
<xsl:import href="../build/check_framework.xsl"/>
<xsl:import href="check_framework.xsl"/>

<xsl:template match="shibmd:Scope[@regexp='true']">
<xsl:call-template name="error">
Expand Down

0 comments on commit 8cc8fe2

Please sign in to comment.