-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbad-one.xslt
More file actions
67 lines (48 loc) · 2.02 KB
/
bad-one.xslt
File metadata and controls
67 lines (48 loc) · 2.02 KB
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
<?xml version="1.0" encoding="utf-8" ?>
<!--
## bad-one.xslt
Contains lots of wrong-doings as a test-file for the `XSLTLint.xslt` file.
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:test="http://xmlns.greystate.dk/2016/testing"
xmlns:exslt="http://exslt.org/common"
exclude-result-prefixes="test"
>
<!-- The `exclude-result-prefixes` attribute above is missing the `exslt` prefix -->
<xsl:output method="html" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPageId" />
<xsl:param name="currentPage" select="//*[@id = $currentPageId]" />
<xsl:variable name="$siteRoot" select="$currentPage/ancestor-or-self::Website" />
<!-- This references an undeclared namespace-prefix -->
<xsl:variable name="data" select="make:node-set($siteRoot)" />
<xsl:template match="/">
<xsl:apply-templates select="$currentPage" />
<!-- These references undeclared variables/params -->
<xsl:value-of select="$not-a-variable" />
<xsl:if test="$not-a-variable-either"><!-- Do something --></xsl:if>
<!-- This one IS declared so shouldn't throw an error -->
<xsl:value-of select="$currentPageId" />
<!-- This uses an AVT inside an expression -->
<xsl:value-of select="{$currentPageId}" />
<!-- This calls a non-existing template -->
<xsl:call-template name="output1" />
<!-- This uses an undeclared key -->
<xsl:apply-templates select="key('not-a-key', 'value')" />
<!-- This calls a template that is wrongly declared as a match template -->
<xsl:call-template name="output2" />
<!-- This performs a call using param instead of with-param -->
<xsl:call-template name="output3">
<xsl:param name="today" select="'2006-01-01'" />
</xsl:call-template>
<!-- This uses a non-existing mode -->
<xsl:apply-templates select="$currentPageId" mode="not-an-actual-mode" />
</xsl:template>
<xsl:template match="output2">
<p>Output</p>
</xsl:template>
<xsl:template name="output3">
<xsl:param name="today" />
</xsl:template>
</xsl:stylesheet>