forked from OpenSCAP/openscap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxccdf-guide.xsl
84 lines (71 loc) · 3.13 KB
/
xccdf-guide.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
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2010-2014 Red Hat Inc., Durham, North Carolina.
All Rights Reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Authors:
Martin Preisler <[email protected]>
Lukas Kuklinek <[email protected]>
-->
<xsl:stylesheet version="1.1"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cdf="http://checklists.nist.gov/xccdf/1.2"
exclude-result-prefixes="xsl cdf">
<xsl:include href="xccdf-guide-impl.xsl" />
<xsl:param name="benchmark_id"/>
<xsl:param name="profile_id"/>
<!-- main(..) -->
<xsl:template match="/">
<xsl:variable name="final_benchmark_id">
<xsl:choose>
<xsl:when test="$benchmark_id">
<xsl:value-of select="$benchmark_id"/>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$verbosity">
<xsl:message>The 'benchmark_id' parameter was not supplied. Using the first cdf:Benchmark found!</xsl:message>
</xsl:if>
<xsl:value-of select="//cdf:Benchmark[1]/@id"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="benchmark" select="//cdf:Benchmark[@id = $final_benchmark_id][1]"/>
<!-- Empty $profile_id is a valid use case! It's the default profile. -->
<xsl:if test="not($benchmark)">
<xsl:choose>
<xsl:when test="$benchmark_id">
<xsl:message terminate="yes">No such cdf:Benchmark exists (with @id = "<xsl:value-of select="$benchmark_id"/>")</xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="yes">No cdf:Benchmark ID specified and no suitable candidate has been autodetected.</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="$verbosity">
<xsl:message>Benchmark ID: <xsl:value-of select="$final_benchmark_id"/></xsl:message>
<xsl:choose>
<xsl:when test="$profile_id">
<xsl:message>Profile ID: <xsl:value-of select="$profile_id"/></xsl:message>
</xsl:when>
<xsl:otherwise>
<xsl:message>Profile: (default)</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:call-template name="generate-guide">
<xsl:with-param name="benchmark" select="$benchmark"/>
<xsl:with-param name="profile_id" select="$profile_id"/>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>