<xsl:copy-of select="."/>
</xsl:template>
- <!-- throw diagnostic for unsupported use attributes -->
- <xsl:template match="attr[@type=1][@value=12]">
- <diagnostic code="114" addinfo="{@value}"/>
+ <!-- validate use attributes -->
+ <xsl:template match="attr[@type=1]">
+ <xsl:choose>
+ <xsl:when test="@value >= 1 and @value <= 11">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:when test="@value >= 13 and @value <= 1010">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:when test="@value >= 1013 and @value <= 1023">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:when test="@value >= 1025 and @value <= 1030">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <diagnostic code="114" addinfo="{@value}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- validate relation attributes -->
+ <xsl:template match="attr[@type=2]">
+ <xsl:choose>
+ <xsl:when test="@value >= 1 and @value <= 6">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <diagnostic code="117" addinfo="{@value}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- validate position attributes -->
+ <xsl:template match="attr[@type=3]">
+ <xsl:choose>
+ <xsl:when test="@value >= 1 and @value <= 3">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <diagnostic code="119" addinfo="{@value}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- validate structure attributes -->
+ <xsl:template match="attr[@type=4]">
+ <xsl:choose>
+ <xsl:when test="@value >= 1 and @value <= 6">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <diagnostic code="118" addinfo="{@value}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- validate truncation attributes -->
+ <xsl:template match="attr[@type=5]">
+ <xsl:choose>
+ <xsl:when test="@value = 1 or @value = 100">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <diagnostic code="120" addinfo="{@value}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- validate completeness attributes -->
+ <xsl:template match="attr[@type=6]">
+ <xsl:choose>
+ <xsl:when test="@value >= 1 and @value <= 3">
+ <xsl:copy-of select="."/>
+ </xsl:when>
+ <xsl:otherwise>
+ <diagnostic code="122" addinfo="{@value}"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- throw error for other types -->
+ <xsl:template match="attr[@type >= 7]">
+ <diagnostic code="113" addinfo="{@type}"/>
</xsl:template>
</xsl:stylesheet>