-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquality-control.xsl
137 lines (124 loc) · 6.61 KB
/
quality-control.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ou="http://omniupdate.com/XSL/Variables"
xmlns:fn="http://omniupdate.com/XSL/Functions"
xmlns:ouc="http://omniupdate.com/XSL/Variables"
exclude-result-prefixes="xs ou fn ouc">
<!-- QC checks! -->
<xsl:template name="meta-qc">
<xsl:param name="document" />
<xsl:if test="($ou:action != 'pub') and ($page-type != '')">
<xsl:variable name="metadesc">
<xsl:value-of select="normalize-space(/document/ouc:properties[@label='metadata']/meta[@name='Meta Description']/@content)"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="string-length($metadesc) lt 1">
<div class="o-wrap--content alert-box alert qc-check">
<p><strong>Quality Control Check:</strong> It looks like the Description in the 'Title and Metadata' section is missing. This field is important to help search engines find and understand what pages are about. Adding a description not only helps this page, but pages that are linked to and from it. Please add a short sentence that describes the page and its purpose. <br/>[<a href="http://a.cms.omniupdate.com/10/#sjsu/sjsu/{$ou:site}/pageparameters{replace($ou:path, '.php','.pcf')}" target="_parent">Go to the parameters of the page</a>]</p>
<p>Your current description: <xsl:value-of select="$metadesc"/></p>
</div>
</xsl:when>
<xsl:when test="string-length($metadesc) lt 50">
<div class="o-wrap--content alert-box warning qc-check">
<p><strong>Quality Control Check:</strong> Thank you for adding a Description in the 'Title and Metadata' section. However, the description is only <strong><xsl:value-of select="string-length($metadesc)" /> characters</strong>, which is short of the recommendation of at least 50 characters. Please expand your meta description with a few more words that describe what this page is about. <br/>[<a href="http://a.cms.omniupdate.com/10/#sjsu/sjsu/{$ou:site}/pageparameters{replace($ou:path, '.php','.pcf')}" target="_parent">Go to the parameters of the page</a>]</p>
<p>Your current description: <xsl:value-of select="$metadesc"/></p>
</div>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
<xsl:if test="ou:textual-content($page-title) = ''">
<div class="o-wrap--content alert-box warning qc-check">
<p><strong>Quality Control Check:</strong> It looks like the Title in the 'Title and Metadata' section is missing. The page's Title is the text that appears in search engines and is very important in helping users find you. <br/>[<a href="http://a.cms.omniupdate.com/10/#sjsu/sjsu/{$ou:site}/pageparameters{replace($ou:path, '.php','.pcf')}" target="_parent">Go to the parameters of the page</a>]</p>
</div>
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template match="span[not(contains(@class,'ou-span-allowed'))]">
<xsl:apply-templates select="node()"/>
</xsl:template>
<xsl:template match="p[node() = '&nbsp;'][not(*)]"></xsl:template>
<xsl:template match="a[contains(lower-case(node()), 'click here')]">
<xsl:if test="$ou:action != 'pub'">
<span data-tooltip="data-tooltip" aria-haspopup="true" class="has-tip code-error" title="'click here' is not appropriate link text. Please re-write the text using direct language that describes the destination of link.">
<span style="background-color:#ff0000;color:#ffffff;"><xsl:value-of select="node()"/></span>
</span>
</xsl:if>
</xsl:template>
<xsl:template match="a[contains(lower-case(node()), 'read more')]">
<xsl:if test="$ou:action != 'pub'">
<span data-tooltip="data-tooltip" aria-haspopup="true" class="has-tip code-error" title="'read more' is not appropriate link text. Please re-write the text using direct language that describes the destination of link.">
<span style="background-color:#ff0000;color:#ffffff;"><xsl:value-of select="node()"/></span>
</span>
</xsl:if>
</xsl:template>
<xsl:template match="a[contains(lower-case(node()), 'learn more')]">
<xsl:if test="$ou:action != 'pub'">
<span data-tooltip="data-tooltip" aria-haspopup="true" class="has-tip code-error" title="'learn more' is not appropriate link text. Please re-write the text using direct language that describes the destination of link.">
<span style="background-color:#ff0000;color:#ffffff;"><xsl:value-of select="node()"/></span>
</span>
</xsl:if>
</xsl:template>
<xsl:template match="a[ends-with(lower-case(@href), '.pdf')]">
<xsl:element name="a">
<!-- copy all link attributes -->
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<!-- get link text and add pdf -->
<xsl:value-of select="concat(., ' [pdf]')" />
</xsl:element>
</xsl:template>
<xsl:template match="a[ends-with(lower-case(@href), '.ppt')]">
<xsl:element name="a">
<!-- copy all link attributes -->
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<!-- get link text and add pdf -->
<xsl:value-of select="concat(., ' [ppt]')" />
</xsl:element>
</xsl:template>
<xsl:template match="a[ends-with(lower-case(@href), '.pptx')]">
<xsl:element name="a">
<!-- copy all link attributes -->
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<!-- get link text and add pdf -->
<xsl:value-of select="concat(., ' [pptx]')" />
</xsl:element>
</xsl:template>
<xsl:template match="a[ends-with(lower-case(@href), '.docx')]">
<xsl:element name="a">
<!-- copy all link attributes -->
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<!-- get link text and add pdf -->
<xsl:value-of select="concat(., ' [docx]')" />
</xsl:element>
</xsl:template>
<xsl:template match="a[ends-with(lower-case(@href), '.doc')]">
<xsl:element name="a">
<!-- copy all link attributes -->
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<!-- get link text and add pdf -->
<xsl:value-of select="concat(., ' [doc]')" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>