Debian Codegraph @

xsl/xccdf-guide.xsl

raw symbols SCIP
1 <?xml version="1.0" encoding="utf-8" ?>
2 <!--
3 Copyright 2010-2014 Red Hat Inc., Durham, North Carolina.
4 All Rights Reserved.
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20 Authors:
21 Martin Preisler <[email protected]>
22 Lukas Kuklinek <[email protected]>
23 -->
24
25 <xsl:stylesheet version="1.1"
26 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
27 xmlns:cdf="http://checklists.nist.gov/xccdf/1.2"
28 exclude-result-prefixes="xsl cdf">
29
30 <xsl:include href="xccdf-guide-impl.xsl" />
31
32 <xsl:param name="benchmark_id"/>
33 <xsl:param name="profile_id"/>
34
35 <!-- main(..) -->
36 <xsl:template match="/">
37 <xsl:variable name="final_benchmark_id">
38 <xsl:choose>
39 <xsl:when test="$benchmark_id">
40 <xsl:value-of select="$benchmark_id"/>
41 </xsl:when>
42 <xsl:otherwise>
43 <xsl:if test="$verbosity">
44 <xsl:message>The 'benchmark_id' parameter was not supplied. Using the first cdf:Benchmark found!</xsl:message>
45 </xsl:if>
46 <xsl:value-of select="//cdf:Benchmark[1]/@id"/>
47 </xsl:otherwise>
48 </xsl:choose>
49 </xsl:variable>
50
51 <xsl:variable name="benchmark" select="//cdf:Benchmark[@id = $final_benchmark_id][1]"/>
52 <!-- Empty $profile_id is a valid use case! It's the default profile. -->
53
54 <xsl:if test="not($benchmark)">
55 <xsl:choose>
56 <xsl:when test="$benchmark_id">
57 <xsl:message terminate="yes">No such cdf:Benchmark exists (with @id = "<xsl:value-of select="$benchmark_id"/>")</xsl:message>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:message terminate="yes">No cdf:Benchmark ID specified and no suitable candidate has been autodetected.</xsl:message>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:if>
64
65 <xsl:if test="$verbosity">
66 <xsl:message>Benchmark ID: <xsl:value-of select="$final_benchmark_id"/></xsl:message>
67 <xsl:choose>
68 <xsl:when test="$profile_id">
69 <xsl:message>Profile ID: <xsl:value-of select="$profile_id"/></xsl:message>
70 </xsl:when>
71 <xsl:otherwise>
72 <xsl:message>Profile: (default)</xsl:message>
73 </xsl:otherwise>
74 </xsl:choose>
75 </xsl:if>
76
77 <xsl:call-template name="generate-guide">
78 <xsl:with-param name="benchmark" select="$benchmark"/>
79 <xsl:with-param name="profile_id" select="$profile_id"/>
80 </xsl:call-template>
81 </xsl:template>
82
83 </xsl:stylesheet>