Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Rewrite mdui:Logo check as a single template to avoid one template ov…
Browse files Browse the repository at this point in the history
…erriding the other.

Add a test for mdui:Logo including a line break, which causes problems for the CDS.
  • Loading branch information
iay committed Nov 4, 2014
1 parent 1b5b0d0 commit 9146be2
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions mdx/_rules/check_mdui.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,16 @@
Section 2.1.5 Element <mdui:Logo>
-->
<xsl:template match="mdui:Logo">
<!--
Logos must never include un-encoded line breaks. This makes them invalid
URLs, but also causes problems with the Shibboleth CDS.
-->
<xsl:if test="contains(., '&#10;')">
<xsl:call-template name="error">
<xsl:with-param name="m">mdui:Logo contains line break</xsl:with-param>
</xsl:call-template>
</xsl:if>

<!--
Require that the URL starts with https://
Expand All @@ -189,28 +199,29 @@
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>

<!--
Check for <mdui:Logo> elements that aren't valid URLs.

Again, explicitly permit anything starting with 'data:'.
-->
<xsl:template match="mdui:Logo[mdxURL:invalidURL(.)]">
<xsl:if test="not(starts-with(., 'data:'))">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>mdui:</xsl:text>
<xsl:value-of select='local-name()'/>
<xsl:text> '</xsl:text>
<xsl:value-of select="."/>
<xsl:text>' is not a valid URL: </xsl:text>
<xsl:value-of select="mdxURL:whyInvalid(.)"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<!--
Check for <mdui:Logo> elements that aren't valid URLs.
Again, explicitly permit anything starting with 'data:', so that the
only validity test we're performing on data: URLs is the "no newline" rule.
-->
<xsl:if test="mdxURL:invalidURL(.)">
<xsl:if test="not(starts-with(., 'data:'))">
<xsl:call-template name="error">
<xsl:with-param name="m">
<xsl:text>mdui:</xsl:text>
<xsl:value-of select='local-name()'/>
<xsl:text> '</xsl:text>
<xsl:value-of select="."/>
<xsl:text>' is not a valid URL: </xsl:text>
<xsl:value-of select="mdxURL:whyInvalid(.)"/>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>

<!--
Section 2.1.6 Element <mdui:InformationURL>
Expand Down

0 comments on commit 9146be2

Please sign in to comment.