"Fossies" - the Fresh Open Source Software Archive

Member "gvmd-9.0.0/src/report_formats/LaTeX/latex.xsl" (11 Oct 2019, 67804 Bytes) of package /linux/misc/openvas/gvmd-9.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) XML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "latex.xsl": 8.0.1_vs_9.0.0.

    1 <?xml version="1.0"?>
    2 
    3 <!--
    4 Copyright (C) 2010-2019 Greenbone Networks GmbH
    5 
    6 SPDX-License-Identifier: GPL-2.0-or-later
    7 
    8 This program is free software; you can redistribute it and/or
    9 modify it under the terms of the GNU General Public License
   10 as published by the Free Software Foundation; either version 2
   11 of the License, or (at your option) any later version.
   12 
   13 This program is distributed in the hope that it will be useful,
   14 but WITHOUT ANY WARRANTY; without even the implied warranty of
   15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16 GNU General Public License for more details.
   17 
   18 You should have received a copy of the GNU General Public License
   19 along with this program; if not, write to the Free Software
   20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21 -->
   22 
   23 <!-- Stylesheet to transform result (report) xml to latex.
   24 
   25 TODOS: Solve Whitespace/Indentation problem of this file.
   26 -->
   27 
   28 <xsl:stylesheet
   29     version="1.0"
   30     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   31     xmlns:func = "http://exslt.org/functions"
   32     xmlns:str="http://exslt.org/strings"
   33     xmlns:gvm="http://greenbone.net"
   34     xmlns:date="http://exslt.org/dates-and-times"
   35     extension-element-prefixes="str func date gvm">
   36   <xsl:output method="text" encoding="string" indent="no"/>
   37   <xsl:strip-space elements="*"/>
   38 
   39   <func:function name="gvm:timezone-abbrev">
   40     <xsl:choose>
   41       <xsl:when test="/report/@extension='xml'">
   42         <func:result select="/report/report/timezone_abbrev"/>
   43       </xsl:when>
   44       <xsl:otherwise>
   45         <func:result select="/report/timezone_abbrev"/>
   46       </xsl:otherwise>
   47     </xsl:choose>
   48   </func:function>
   49 
   50   <func:function name="gvm:get-nvt-tag">
   51     <xsl:param name="tags"/>
   52     <xsl:param name="name"/>
   53     <xsl:variable name="after">
   54       <xsl:value-of select="substring-after (nvt/tags, concat ($name, '='))"/>
   55     </xsl:variable>
   56     <xsl:choose>
   57         <xsl:when test="contains ($after, '|')">
   58           <func:result select="substring-before ($after, '|')"/>
   59         </xsl:when>
   60         <xsl:otherwise>
   61           <func:result select="$after"/>
   62         </xsl:otherwise>
   63     </xsl:choose>
   64   </func:function>
   65 
   66   <func:function name="gvm:report">
   67     <xsl:choose>
   68       <xsl:when test="count(/report/report) &gt; 0">
   69         <func:result select="/report/report"/>
   70       </xsl:when>
   71       <xsl:otherwise>
   72         <func:result select="/report"/>
   73       </xsl:otherwise>
   74     </xsl:choose>
   75   </func:function>
   76 
   77   <xsl:template match="scan_start" name="format-date">
   78     <xsl:param name="date" select="."/>
   79     <xsl:if test="string-length ($date)">
   80       <xsl:value-of select="concat (date:day-abbreviation ($date), ' ', date:month-abbreviation ($date), ' ', date:day-in-month ($date), ' ', format-number(date:hour-in-day($date), '00'), ':', format-number(date:minute-in-hour($date), '00'), ':', format-number(date:second-in-minute($date), '00'), ' ', date:year($date), ' ', gvm:timezone-abbrev ())"/>
   81     </xsl:if>
   82   </xsl:template>
   83 
   84   <xsl:template match="scan_end">
   85     <xsl:param name="date" select="."/>
   86     <xsl:if test="string-length ($date)">
   87       <xsl:value-of select="concat (date:day-abbreviation ($date), ' ', date:month-abbreviation ($date), ' ', date:day-in-month ($date), ' ', format-number(date:hour-in-day($date), '00'), ':', format-number(date:minute-in-hour($date), '00'), ':', format-number(date:second-in-minute($date), '00'), ' ', date:year($date), ' ', gvm:timezone-abbrev ())"/>
   88     </xsl:if>
   89   </xsl:template>
   90 
   91   <!-- A newline, after countless failed tries to define a newline-entity. -->
   92   <xsl:template name="newline">
   93     <xsl:text>
   94 </xsl:text>
   95   </xsl:template>
   96 
   97 
   98 <!-- TEMPLATES MATCHING LATEX COMMANDS -->
   99 
  100   <!-- Simple Latex Context. -->
  101   <xsl:template name="latex-simple-command">
  102     <xsl:param name="command"/>
  103     <xsl:param name="content"/>
  104     <xsl:text>\</xsl:text>
  105     <xsl:value-of select="command"/>
  106     <xsl:text>{</xsl:text>
  107     <xsl:value-of select="$content"/>
  108     <xsl:text>}</xsl:text>
  109     <xsl:call-template name="newline"/>
  110   </xsl:template>
  111 
  112   <!-- A Latex Label. -->
  113   <xsl:template name="latex-label">
  114     <xsl:param name="label_string"/>
  115     <xsl:text>\label{</xsl:text><xsl:value-of select="$label_string"/><xsl:text>}</xsl:text>
  116     <xsl:call-template name="newline"/>
  117   </xsl:template>
  118 
  119   <!-- A Latex Section. -->
  120   <xsl:template name="latex-section">
  121     <xsl:param name="section_string"/>
  122     <xsl:text>\section{</xsl:text><xsl:value-of select="$section_string"/><xsl:text>}</xsl:text>
  123     <xsl:call-template name="newline"/>
  124   </xsl:template>
  125 
  126   <!-- A Latex Subsection. -->
  127   <xsl:template name="latex-subsection">
  128     <xsl:param name="subsection_string"/>
  129     <xsl:text>\subsection{</xsl:text>
  130     <xsl:call-template name="escape_text">
  131       <xsl:with-param name="string" select="$subsection_string"/>
  132     </xsl:call-template>
  133     <xsl:text>}</xsl:text>
  134     <xsl:call-template name="newline"/>
  135   </xsl:template>
  136 
  137   <!-- A Latex Subsubsection. -->
  138   <xsl:template name="latex-subsubsection">
  139     <xsl:param name="subsubsection_string"/>
  140     <xsl:text>\subsubsection{</xsl:text>
  141     <xsl:call-template name="escape_text">
  142       <xsl:with-param name="string" select="$subsubsection_string"/>
  143     </xsl:call-template>
  144     <xsl:text>}</xsl:text>
  145     <xsl:call-template name="newline"/>
  146   </xsl:template>
  147 
  148   <!-- \\ -->
  149   <xsl:template name="latex-newline">
  150     <xsl:text>\\</xsl:text><xsl:call-template name="newline"/>
  151   </xsl:template>
  152 
  153   <!-- Latex \hline command. -->
  154   <xsl:template name="latex-hline">
  155     <xsl:text>\hline</xsl:text><xsl:call-template name="newline"/>
  156   </xsl:template>
  157 
  158   <!-- Latex \hyperref command. -->
  159   <xsl:template name="latex-hyperref">
  160     <xsl:param name="target"/>
  161     <xsl:param name="text"/>
  162     <xsl:text>\hyperref[</xsl:text>
  163     <xsl:value-of select="$target"/>
  164     <xsl:text>]{</xsl:text>
  165     <xsl:call-template name="escape_text">
  166       <xsl:with-param name="string" select="$text"/>
  167     </xsl:call-template>
  168     <xsl:text>}</xsl:text>
  169   </xsl:template>
  170 
  171 <!-- BUILDING- BLOCK- TEMPLATES -->
  172 
  173   <!-- The longtable block to defined what to print if a page break falls
  174        within a table. -->
  175   <xsl:template name="longtable-continue-block">
  176     <xsl:param name="number-of-columns"/>
  177     <xsl:param name="header-color"/>
  178     <xsl:param name="header-text"/>
  179     <xsl:text>\rowcolor{</xsl:text><xsl:value-of select="$header-color"/><xsl:text>}</xsl:text><xsl:value-of select="$header-text"/>
  180     <xsl:call-template name="latex-newline"/>
  181     <xsl:call-template name="latex-hline"/>
  182     <xsl:text>\endfirsthead</xsl:text><xsl:call-template name="newline"/>
  183     <xsl:text>\multicolumn{</xsl:text><xsl:value-of select="$number-of-columns"/><xsl:text>}{l}{\hfill\ldots (continued) \ldots}</xsl:text>
  184     <xsl:call-template name="latex-newline"/>
  185     <xsl:call-template name="latex-hline"/>
  186     <xsl:text>\rowcolor{</xsl:text><xsl:value-of select="$header-color"/><xsl:text>}</xsl:text><xsl:value-of select="$header-text"/>
  187     <xsl:call-template name="latex-newline"/>
  188     <xsl:call-template name="latex-hline"/>
  189     <xsl:text>\endhead</xsl:text><xsl:call-template name="newline"/>
  190     <xsl:call-template name="latex-hline"/>
  191     <xsl:text>\multicolumn{</xsl:text><xsl:value-of select="$number-of-columns"/><xsl:text>}{l}{\ldots (continues) \ldots}</xsl:text><xsl:call-template name="latex-newline"/>
  192     <xsl:text>\endfoot</xsl:text><xsl:call-template name="newline"/>
  193     <xsl:call-template name="latex-hline"/>
  194     <xsl:text>\endlastfoot</xsl:text><xsl:call-template name="newline"/>
  195     <xsl:call-template name="latex-hline"/>
  196   </xsl:template>
  197 
  198   <!-- The latex header. -->
  199   <xsl:template name="header">
  200     <xsl:text>\documentclass{article}
  201 \pagestyle{empty}
  202 
  203 %\usepackage{color}
  204 \usepackage{tabularx}
  205 \usepackage{geometry}
  206 \usepackage{comment}
  207 \usepackage{longtable}
  208 \usepackage{titlesec}
  209 \usepackage{chngpage}
  210 \usepackage{calc}
  211 \usepackage{url}
  212 \usepackage[utf8x]{inputenc}
  213 
  214 % Fontsetup
  215 \usepackage[T1]{fontenc}
  216 
  217 \DeclareUnicodeCharacter {135}{{\textascii ?}}
  218 \DeclareUnicodeCharacter {129}{{\textascii ?}}
  219 \DeclareUnicodeCharacter {128}{{\textascii ?}}
  220 
  221 \usepackage{colortbl}
  222 
  223 % must come last
  224 \usepackage{hyperref}
  225 \definecolor{linkblue}{rgb}{0.11,0.56,1}
  226 \definecolor{inactive}{rgb}{0.56,0.56,0.56}
  227 \definecolor{gvm_debug}{rgb}{0.78,0.78,0.78}
  228 \definecolor{gvm_false_positive}{rgb}{0.2275,0.2275,0.2275}
  229 \definecolor{gvm_log}{rgb}{0.2275,0.2275,0.2275}
  230 \definecolor{gvm_hole}{rgb}{0.7960,0.1137,0.0902}
  231 \definecolor{gvm_note}{rgb}{0.3255,0.6157,0.7961}
  232 \definecolor{gvm_report}{rgb}{0.68,0.74,0.88}
  233 \definecolor{gvm_user_note}{rgb}{1.0,1.0,0.5625}
  234 \definecolor{gvm_user_override}{rgb}{1.0,1.0,0.5625}
  235 \definecolor{gvm_warning}{rgb}{0.9764,0.6235,0.1922}
  236 \definecolor{chunk}{rgb}{0.9412,0.8275,1}
  237 \definecolor{line_new}{rgb}{0.89,1,0.89}
  238 \definecolor{line_gone}{rgb}{1.0,0.89,0.89}
  239 \hypersetup{colorlinks=true,linkcolor=linkblue,urlcolor=blue,bookmarks=true,bookmarksopen=true}
  240 \usepackage[all]{hypcap}
  241 
  242 %\geometry{verbose,a4paper,tmargin=24mm,bottom=24mm}
  243 \geometry{verbose,a4paper}
  244 \setlength{\parskip}{\smallskipamount}
  245 \setlength{\parindent}{0pt}
  246 </xsl:text>
  247 <xsl:choose>
  248   <xsl:when test="gvm:report()/delta">
  249     <xsl:text>\title{Delta Report}</xsl:text>
  250   </xsl:when>
  251   <xsl:otherwise>
  252     <xsl:text>\title{Scan Report}</xsl:text>
  253   </xsl:otherwise>
  254 </xsl:choose>
  255 <xsl:text>
  256 \pagestyle{headings}
  257 \pagenumbering{arabic}
  258 </xsl:text>
  259   </xsl:template>
  260 
  261   <xsl:template name="escape_special_chars">
  262     <xsl:param name="string"/>
  263     <xsl:value-of select="str:replace(
  264       str:replace(
  265       str:replace(
  266       str:replace(
  267       str:replace(
  268       str:replace(
  269       str:replace(
  270       str:replace(
  271       $string,
  272       '$', '\$'),
  273       '_', '\_'),
  274       '%', '\%'),
  275       '&amp;','\&amp;'),
  276       '#', '\#'),
  277       '}', '\}'),
  278       '{', '\}'),
  279       '^', '\^{}')"/>
  280   </xsl:template>
  281 
  282   <!-- Escape text for normal latex environment. Following characters get a
  283        prepended backslash: #$%&_^{} -->
  284   <xsl:template name="escape_text">
  285     <xsl:param name="string"/>
  286     <!-- Replace backslashes and $'s .-->
  287     <xsl:choose>
  288       <xsl:when test="contains($string, '\')">
  289         <xsl:for-each select="str:tokenize($string, '\')">
  290           <xsl:if test="position() != 1">
  291             <xsl:text>\textbackslash{}</xsl:text>
  292           </xsl:if>
  293           <xsl:call-template name="escape_special_chars">
  294             <xsl:with-param name="string" select="."/>
  295           </xsl:call-template>
  296         </xsl:for-each>
  297       </xsl:when>
  298       <xsl:otherwise>
  299         <xsl:call-template name="escape_special_chars">
  300           <xsl:with-param name="string" select="$string"/>
  301         </xsl:call-template>
  302       </xsl:otherwise>
  303     </xsl:choose>
  304   </xsl:template>
  305 
  306   <!-- Create a verbatim indented row. -->
  307   <xsl:template name="wrap-row-indented">
  308     <xsl:param name="line"/>
  309     <xsl:param name="color">white</xsl:param>
  310     <xsl:text>\rowcolor{</xsl:text>
  311     <xsl:value-of select="$color"/>
  312     <xsl:text>}{$\hookrightarrow$\verb=</xsl:text>
  313     <xsl:value-of select="str:replace($line, '=', '=\verb-=-\verb=')"/>
  314     <!-- Inline latex-newline for speed. -->
  315     <xsl:text>=}\\
  316 </xsl:text>
  317   </xsl:template>
  318 
  319   <!-- Create a verbatim row. -->
  320   <!-- This is called very often, and is relatively slow. -->
  321   <xsl:template name="wrap-row">
  322     <xsl:param name="line"/>
  323     <xsl:text>\rowcolor{white}{\verb=</xsl:text>
  324     <xsl:value-of select="str:replace($line, '=', '=\verb-=-\verb=')"/>
  325     <!-- Inline latex-newline for speed. -->
  326     <xsl:text>=}\\
  327 </xsl:text>
  328   </xsl:template>
  329 
  330   <!-- Create a verbatim row. -->
  331   <!-- This is called very often, and is relatively slow. -->
  332   <xsl:template name="wrap-row-color">
  333     <xsl:param name="line"/>
  334     <xsl:param name="color">white</xsl:param>
  335     <xsl:text>\rowcolor{</xsl:text>
  336     <xsl:value-of select="$color"/>
  337     <xsl:text>}{\verb=</xsl:text>
  338     <xsl:value-of select="str:replace($line, '=', '=\verb-=-\verb=')"/>
  339     <!-- Inline latex-newline for speed. -->
  340     <xsl:text>=}\\
  341 </xsl:text>
  342   </xsl:template>
  343 
  344   <!-- Takes a string that does not contain a newline char and outputs $max
  345        characters long lines. -->
  346   <xsl:template name="break-into-rows-indented">
  347     <xsl:param name="string"/>
  348     <xsl:variable name="head" select="substring($string, 1, 78)"/>
  349     <xsl:variable name="tail" select="substring($string, 79)"/>
  350     <xsl:if test="string-length($head) &gt; 0">
  351       <xsl:call-template name="wrap-row-indented">
  352         <xsl:with-param name="line" select="$head"/>
  353       </xsl:call-template>
  354     </xsl:if>
  355     <xsl:if test="string-length($tail) &gt; 0">
  356       <xsl:call-template name="break-into-rows-indented">
  357         <xsl:with-param name="string" select="$tail"/>
  358       </xsl:call-template>
  359     </xsl:if>
  360   </xsl:template>
  361 
  362   <!-- Takes a string that does not contain a newline char and outputs $max
  363        characters long lines. -->
  364   <xsl:template name="break-into-rows-indented-color">
  365     <xsl:param name="string"/>
  366     <xsl:param name="color">white</xsl:param>
  367     <xsl:variable name="head" select="substring($string, 1, 78)"/>
  368     <xsl:variable name="tail" select="substring($string, 79)"/>
  369     <xsl:if test="string-length($head) &gt; 0">
  370       <xsl:call-template name="wrap-row-indented">
  371         <xsl:with-param name="line" select="$head"/>
  372         <xsl:with-param name="color" select="$color"/>
  373       </xsl:call-template>
  374     </xsl:if>
  375     <xsl:if test="string-length($tail) &gt; 0">
  376       <xsl:call-template name="break-into-rows-indented-color">
  377         <xsl:with-param name="string" select="$tail"/>
  378         <xsl:with-param name="color" select="$color"/>
  379       </xsl:call-template>
  380     </xsl:if>
  381   </xsl:template>
  382 
  383   <!-- Takes a string that does not contain a newline char and outputs $max
  384        characters long lines. -->
  385   <xsl:template name="break-into-rows">
  386     <xsl:param name="string"/>
  387     <xsl:variable name="head" select="substring($string, 1, 80)"/>
  388     <xsl:variable name="tail" select="substring($string, 81)"/>
  389     <xsl:if test="string-length($head) &gt; 0">
  390       <xsl:call-template name="wrap-row">
  391         <xsl:with-param name="line" select="$head"/>
  392       </xsl:call-template>
  393     </xsl:if>
  394     <xsl:if test="string-length($tail) &gt; 0">
  395       <xsl:call-template name="break-into-rows-indented">
  396         <xsl:with-param name="string" select="$tail"/>
  397       </xsl:call-template>
  398     </xsl:if>
  399   </xsl:template>
  400 
  401   <!-- Takes a string that does not contain a newline char and outputs $max
  402        characters long lines. -->
  403   <xsl:template name="break-into-rows-color">
  404     <xsl:param name="string"/>
  405     <xsl:param name="color">white</xsl:param>
  406     <xsl:variable name="head" select="substring($string, 1, 80)"/>
  407     <xsl:variable name="tail" select="substring($string, 81)"/>
  408     <xsl:if test="string-length($head) &gt; 0">
  409       <xsl:call-template name="wrap-row-color">
  410         <xsl:with-param name="line" select="$head"/>
  411         <xsl:with-param name="color" select="$color"/>
  412       </xsl:call-template>
  413     </xsl:if>
  414     <xsl:if test="string-length($tail) &gt; 0">
  415       <xsl:call-template name="break-into-rows-indented-color">
  416         <xsl:with-param name="string" select="$tail"/>
  417         <xsl:with-param name="color" select="$color"/>
  418       </xsl:call-template>
  419     </xsl:if>
  420   </xsl:template>
  421 
  422   <!-- Currently only a very simple formatting method to produce
  423        nice LaTeX from a structured text:
  424        - create paragraphs for each text block separated with a empty line
  425   -->
  426   <xsl:template name="structured-text">
  427     <xsl:param name="string"/>
  428   
  429     <xsl:for-each select="str:split($string, '&#10;&#10;')">
  430       <xsl:call-template name="escape_text">
  431         <xsl:with-param name="string" select="."/>
  432       </xsl:call-template>
  433       <xsl:call-template name="latex-newline"/>
  434     </xsl:for-each>
  435   </xsl:template>
  436 
  437   <!-- -->
  438   <xsl:template name="text-to-escaped-row">
  439     <xsl:param name="string"/>
  440     <xsl:for-each select="str:tokenize($string, '&#10;')">
  441       <xsl:call-template name="break-into-rows">
  442         <xsl:with-param name="string" select="."/>
  443       </xsl:call-template>
  444     </xsl:for-each>
  445   </xsl:template>
  446 
  447   <!-- -->
  448   <xsl:template name="text-to-escaped-row-color">
  449     <xsl:param name="string"/>
  450     <xsl:param name="color">white</xsl:param>
  451     <xsl:for-each select="str:tokenize($string, '&#10;')">
  452       <xsl:call-template name="break-into-rows-color">
  453         <xsl:with-param name="string" select="."/>
  454         <xsl:with-param name="color" select="$color"/>
  455       </xsl:call-template>
  456     </xsl:for-each>
  457   </xsl:template>
  458 
  459   <!-- -->
  460   <xsl:template name="text-to-escaped-diff-row">
  461     <xsl:param name="string"/>
  462     <xsl:for-each select="str:tokenize($string, '&#10;')">
  463       <xsl:call-template name="break-into-rows-color">
  464         <xsl:with-param name="string" select="."/>
  465         <xsl:with-param name="color">
  466           <xsl:choose>
  467             <xsl:when test="substring(., 1, 2) = '@@'">chunk</xsl:when>
  468             <xsl:when test="substring(., 1, 1) = '-'">line_gone</xsl:when>
  469             <xsl:when test="substring(., 1, 1) = '+'">line_new</xsl:when>
  470             <xsl:otherwise>white</xsl:otherwise>
  471           </xsl:choose>
  472         </xsl:with-param>
  473       </xsl:call-template>
  474     </xsl:for-each>
  475   </xsl:template>
  476 
  477   <!-- The Abstract. -->
  478   <xsl:template name="abstract">
  479     <xsl:choose>
  480       <xsl:when test="gvm:report()/delta and gvm:report()/report_format/param[name='summary']">
  481         <xsl:text>
  482 \renewcommand{\abstractname}{Delta Report Summary}
  483 \begin{abstract}
  484 </xsl:text>
  485         <xsl:value-of select="gvm:report()/report_format/param[name='summary']/value"/>
  486         <xsl:text>
  487 \end{abstract}
  488 </xsl:text>
  489       </xsl:when>
  490       <xsl:when test="gvm:report()/report_format/param[name='summary']">
  491         <xsl:text>
  492 \renewcommand{\abstractname}{Summary}
  493 \begin{abstract}
  494 </xsl:text>
  495         <xsl:value-of select="gvm:report()/report_format/param[name='summary']/value"/>
  496         <xsl:text>
  497 \end{abstract}
  498 </xsl:text>
  499       </xsl:when>
  500       <xsl:when test="gvm:report()/delta">
  501         <xsl:text>
  502 \renewcommand{\abstractname}{Delta Report Summary}
  503 \begin{abstract}
  504 This document compares the results of two security scans.
  505 All dates are displayed using the timezone ``</xsl:text>
  506         <xsl:value-of select="timezone"/>
  507         <xsl:text>'', which is abbreviated ``</xsl:text>
  508         <xsl:value-of select="timezone_abbrev"/>
  509         <xsl:text>''.
  510 The task was ``</xsl:text>
  511         <xsl:call-template name="escape_text">
  512           <xsl:with-param name="string" select="/report/task/name"/>
  513         </xsl:call-template>
  514         <xsl:text>''.  The first scan started at </xsl:text>
  515         <xsl:apply-templates select="scan_start"/>
  516 <xsl:text> and ended at </xsl:text>
  517           <xsl:value-of select="scan_end"/>
  518 <xsl:text>.
  519 The second scan started at </xsl:text>
  520         <xsl:apply-templates select="delta/report/scan_start"/>
  521 <xsl:text> and ended at </xsl:text>
  522         <xsl:apply-templates select="delta/report/scan_end"/>
  523 <xsl:text>.
  524 The report first summarises the hosts found.  Then, for each host,
  525 the report describes the changes that occurred between the two scans.
  526 \end{abstract}
  527 </xsl:text>
  528       </xsl:when>
  529       <xsl:otherwise>
  530         <xsl:text>
  531 \renewcommand{\abstractname}{Summary}
  532 \begin{abstract}
  533 This document reports on the results of an automatic security scan.
  534 All dates are displayed using the timezone ``</xsl:text>
  535         <xsl:value-of select="timezone"/>
  536         <xsl:text>'', which is abbreviated ``</xsl:text>
  537         <xsl:value-of select="timezone_abbrev"/>
  538         <xsl:text>''.
  539 The task was ``</xsl:text>
  540         <xsl:call-template name="escape_text">
  541           <xsl:with-param name="string" select="/report/task/name"/>
  542         </xsl:call-template>
  543         <xsl:text>''.  The scan started at </xsl:text>
  544         <xsl:apply-templates select="scan_start"/>
  545 <xsl:text> and ended at </xsl:text>
  546         <xsl:apply-templates select="scan_end"/>
  547 <xsl:text>.  The
  548 report first summarises the results found.  Then, for each host,
  549 the report describes every issue found.  Please consider the
  550 advice given in each description, in order to rectify the issue.
  551 \end{abstract}
  552 </xsl:text>
  553       </xsl:otherwise>
  554     </xsl:choose>
  555   </xsl:template>
  556 
  557   <!-- The Table of Contents. -->
  558   <xsl:template name="toc">
  559     <xsl:text>\tableofcontents</xsl:text><xsl:call-template name="newline"/>
  560   </xsl:template>
  561 
  562   <!-- Row in table with count of issues for a single host. -->
  563   <xsl:template name="results-overview-table-single-host-row">
  564     <xsl:variable name="host" select="ip"/>
  565     <xsl:variable name="hostname" select="detail[name/text() = 'hostname']/value"/>
  566     <xsl:call-template name="latex-hyperref">
  567       <xsl:with-param name="target" select="concat('host:',$host)"/>
  568       <xsl:with-param name="text" select="$host"/>
  569     </xsl:call-template>
  570     <xsl:text>&amp;</xsl:text>
  571     <xsl:value-of select="count(../results/result[host/text()=$host][threat/text()='High'])"/>
  572     <xsl:text>&amp;</xsl:text>
  573     <xsl:value-of select="count(../results/result[host/text()=$host][threat/text()='Medium'])"/>
  574     <xsl:text>&amp;</xsl:text>
  575     <xsl:value-of select="count(../results/result[host/text()=$host][threat/text()='Low'])"/>
  576     <xsl:text>&amp;</xsl:text>
  577     <xsl:value-of select="count(../results/result[host/text()=$host][threat/text()='Log'])"/>
  578     <xsl:text>&amp;</xsl:text>
  579     <xsl:value-of select="count(../results/result[host/text()=$host][threat/text()='False Positive'])"/>
  580     <xsl:call-template name="latex-newline"/>
  581     <xsl:choose>
  582       <xsl:when test="$hostname">
  583         <xsl:call-template name="latex-hyperref">
  584           <xsl:with-param name="target" select="concat('host:',$host)"/>
  585           <xsl:with-param name="text" select="$hostname"/>
  586         </xsl:call-template>
  587         <xsl:text>&amp;&amp;&amp;&amp;&amp;</xsl:text>
  588         <xsl:call-template name="latex-newline"/>
  589       </xsl:when>
  590       <xsl:otherwise>
  591       </xsl:otherwise>
  592     </xsl:choose>
  593     <xsl:call-template name="latex-hline"/>
  594   </xsl:template>
  595 
  596   <xsl:template name="auth-success-row">
  597     <xsl:variable name="host" select="./ip"/>
  598     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-SSH-Success']">
  599       <xsl:value-of select="$host"/>
  600       <xsl:choose>
  601         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  602           <xsl:text> - </xsl:text>
  603           <xsl:call-template name="escape_text">
  604             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  605           </xsl:call-template>
  606         </xsl:when>
  607       </xsl:choose>
  608       <xsl:text> &amp; </xsl:text>
  609       <xsl:text>SSH</xsl:text>
  610       <xsl:text> &amp; </xsl:text>
  611       <xsl:text>Success</xsl:text>
  612       <xsl:text> &amp; </xsl:text>
  613       <xsl:value-of select="value/text()"/>\\ \hline
  614     </xsl:for-each>
  615     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-SSH-Failure']">
  616       <xsl:value-of select="$host"/>
  617       <xsl:choose>
  618         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  619           <xsl:text> - </xsl:text>
  620           <xsl:call-template name="escape_text">
  621             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  622           </xsl:call-template>
  623         </xsl:when>
  624       </xsl:choose>
  625       <xsl:text> &amp; </xsl:text>
  626       <xsl:text>SSH</xsl:text>
  627       <xsl:text> &amp; </xsl:text>
  628       <xsl:text>Failure</xsl:text>
  629       <xsl:text> &amp; </xsl:text>
  630       <xsl:value-of select="value/text()"/>\\ \hline
  631     </xsl:for-each>
  632     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-SMB-Success']">
  633       <xsl:value-of select="$host"/>
  634       <xsl:choose>
  635         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  636           <xsl:text> - </xsl:text>
  637           <xsl:call-template name="escape_text">
  638             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  639           </xsl:call-template>
  640         </xsl:when>
  641       </xsl:choose>
  642       <xsl:text> &amp; </xsl:text>
  643       <xsl:text>SMB</xsl:text>
  644       <xsl:text> &amp; </xsl:text>
  645       <xsl:text>Success</xsl:text>
  646       <xsl:text> &amp; </xsl:text>
  647       <xsl:value-of select="value/text()"/>\\ \hline
  648     </xsl:for-each>
  649     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-SMB-Failure']">
  650       <xsl:value-of select="$host"/>
  651       <xsl:choose>
  652         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  653           <xsl:text> - </xsl:text>
  654           <xsl:call-template name="escape_text">
  655             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  656           </xsl:call-template>
  657         </xsl:when>
  658       </xsl:choose>
  659       <xsl:text> &amp; </xsl:text>
  660       <xsl:text>SMB</xsl:text>
  661       <xsl:text> &amp; </xsl:text>
  662       <xsl:text>Failure</xsl:text>
  663       <xsl:text> &amp; </xsl:text>
  664       <xsl:value-of select="value/text()"/>\\ \hline
  665     </xsl:for-each>
  666     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-ESXi-Success']">
  667       <xsl:value-of select="$host"/>
  668       <xsl:choose>
  669         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  670           <xsl:text> - </xsl:text>
  671           <xsl:call-template name="escape_text">
  672             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  673           </xsl:call-template>
  674         </xsl:when>
  675       </xsl:choose>
  676       <xsl:text> &amp; </xsl:text>
  677       <xsl:text>ESXi</xsl:text>
  678       <xsl:text> &amp; </xsl:text>
  679       <xsl:text>Success</xsl:text>
  680       <xsl:text> &amp; </xsl:text>
  681       <xsl:value-of select="value/text()"/>\\ \hline
  682     </xsl:for-each>
  683     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-ESXi-Failure']">
  684       <xsl:value-of select="$host"/>
  685       <xsl:choose>
  686         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  687           <xsl:text> - </xsl:text>
  688           <xsl:call-template name="escape_text">
  689             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  690           </xsl:call-template>
  691         </xsl:when>
  692       </xsl:choose>
  693       <xsl:text> &amp; </xsl:text>
  694       <xsl:text>ESXi</xsl:text>
  695       <xsl:text> &amp; </xsl:text>
  696       <xsl:text>Failure</xsl:text>
  697       <xsl:text> &amp; </xsl:text>
  698       <xsl:value-of select="value/text()"/>\\ \hline
  699     </xsl:for-each>
  700     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-SNMP-Success']">
  701       <xsl:value-of select="$host"/>
  702       <xsl:choose>
  703         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  704           <xsl:text> - </xsl:text>
  705           <xsl:call-template name="escape_text">
  706             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  707           </xsl:call-template>
  708         </xsl:when>
  709       </xsl:choose>
  710       <xsl:text> &amp; </xsl:text>
  711       <xsl:text>SNMP</xsl:text>
  712       <xsl:text> &amp; </xsl:text>
  713       <xsl:text>Success</xsl:text>
  714       <xsl:text> &amp; </xsl:text>
  715       <xsl:value-of select="value/text()"/>\\ \hline
  716     </xsl:for-each>
  717     <xsl:for-each select="/report/host[ip=$host]/detail[name='Auth-SNMP-Failure']">
  718       <xsl:value-of select="$host"/>
  719       <xsl:choose>
  720         <xsl:when test="string-length(/report/host[ip=$host]/detail[name='hostname']/value) &gt; 0">
  721           <xsl:text> - </xsl:text>
  722           <xsl:call-template name="escape_text">
  723             <xsl:with-param name="string" select="/report/host[ip=$host]/detail[name='hostname']/value/text()"/>
  724           </xsl:call-template>
  725         </xsl:when>
  726       </xsl:choose>
  727       <xsl:text> &amp; </xsl:text>
  728       <xsl:text>SNMP</xsl:text>
  729       <xsl:text> &amp; </xsl:text>
  730       <xsl:text>Failure</xsl:text>
  731       <xsl:text> &amp; </xsl:text>
  732       <xsl:value-of select="value/text()"/>\\ \hline
  733     </xsl:for-each>
  734   </xsl:template>
  735 
  736   <!-- The Results Overview section. -->
  737   <xsl:template name="results-overview">
  738     <xsl:call-template name="latex-section">
  739       <xsl:with-param name="section_string">Result Overview</xsl:with-param>
  740     </xsl:call-template>
  741     <xsl:call-template name="newline"/>
  742 
  743     <xsl:text>\begin{longtable}{|l|l|l|l|l|l|}</xsl:text><xsl:call-template name="newline"/>
  744     <xsl:call-template name="latex-hline"/>
  745     <xsl:call-template name="longtable-continue-block">
  746       <xsl:with-param name="number-of-columns">6</xsl:with-param>
  747       <xsl:with-param name="header-color">gvm_report</xsl:with-param>
  748       <xsl:with-param name="header-text">Host&amp;High&amp;Medium&amp;Low&amp;Log&amp;False Positive</xsl:with-param>
  749     </xsl:call-template>
  750     <xsl:for-each select="host"><xsl:call-template name="results-overview-table-single-host-row"/></xsl:for-each>
  751     <xsl:call-template name="latex-hline"/>
  752     <xsl:text>Total: </xsl:text>
  753     <xsl:value-of select="count(gvm:report()/host)"/>&amp;<xsl:value-of select="count(gvm:report()/results/result[threat = 'High'])"/>&amp;<xsl:value-of select="count(gvm:report()/results/result[threat = 'Medium'])"/>&amp;<xsl:value-of select="count(gvm:report()/results/result[threat = 'Low'])"/>&amp;<xsl:value-of select="count(gvm:report()/results/result[threat = 'Log'])"/>&amp;<xsl:value-of select="count(gvm:report()/results/result[threat = 'False Positive'])"/><xsl:call-template name="latex-newline"/>
  754     <xsl:call-template name="latex-hline"/>
  755     <xsl:text>\end{longtable}</xsl:text><xsl:call-template name="newline"/>
  756 
  757     <xsl:choose>
  758       <xsl:when test="gvm:report()/filters/keywords/keyword[column='autofp']/value='1'">
  759         <xsl:text>Vendor security updates are trusted, using full CVE matching.</xsl:text>
  760       </xsl:when>
  761       <xsl:when test="gvm:report()/filters/keywords/keyword[column='autofp']/value='2'">
  762         <xsl:text>Vendor security updates are trusted, using partial CVE matching.</xsl:text>
  763       </xsl:when>
  764       <xsl:otherwise>
  765         <xsl:text>Vendor security updates are not trusted.</xsl:text>
  766       </xsl:otherwise>
  767     </xsl:choose>
  768     <xsl:call-template name="latex-newline"/>
  769     <xsl:choose>
  770       <xsl:when test="gvm:report()/filters/keywords/keyword[column='apply_overrides']/value='1'">
  771         <xsl:text>Overrides are on.  When a result has an override, this report uses the threat of the override.</xsl:text>
  772         <xsl:call-template name="latex-newline"/>
  773       </xsl:when>
  774       <xsl:otherwise>
  775         <xsl:text>Overrides are off.  Even when a result has an override, this report uses the actual threat of the result.</xsl:text>
  776         <xsl:call-template name="latex-newline"/>
  777       </xsl:otherwise>
  778     </xsl:choose>
  779     <xsl:choose>
  780       <xsl:when test="gvm:report()/filters/keywords/keyword[column='overrides']/value = 0">
  781         <xsl:text>Information on overrides is excluded from the report.</xsl:text>
  782         <xsl:call-template name="latex-newline"/>
  783       </xsl:when>
  784       <xsl:otherwise>
  785         <xsl:text>Information on overrides is included in the report.</xsl:text>
  786         <xsl:call-template name="latex-newline"/>
  787       </xsl:otherwise>
  788     </xsl:choose>
  789     <xsl:choose>
  790       <xsl:when test="gvm:report()/filters/keywords/keyword[column='notes']/value = 0">
  791         <xsl:text>Notes are excluded from the report.</xsl:text>
  792         <xsl:call-template name="latex-newline"/>
  793       </xsl:when>
  794       <xsl:otherwise>
  795         <xsl:text>Notes are included in the report.</xsl:text>
  796         <xsl:call-template name="latex-newline"/>
  797       </xsl:otherwise>
  798     </xsl:choose>
  799 
  800     <xsl:text>This report might not show details of all issues that were found.</xsl:text><xsl:call-template name="latex-newline"/>
  801     <xsl:if test="gvm:report()/filters/keywords/keyword[column='result_hosts_only']/value = 1">
  802       <xsl:text>It only lists hosts that produced issues.</xsl:text><xsl:call-template name="latex-newline"/>
  803     </xsl:if>
  804     <xsl:if test="string-length(gvm:report()/filters/phrase) &gt; 0">
  805       <xsl:text>It shows issues that contain the search phrase "</xsl:text><xsl:value-of select="gvm:report()/filters/phrase"/><xsl:text>".</xsl:text>
  806       <xsl:call-template name="latex-newline"/>
  807     </xsl:if>
  808     <xsl:if test="contains(gvm:report()/filters/keywords/keyword[column='levels']/value, 'h') = false">
  809       <xsl:text>Issues with the threat level ``High'' are not shown.</xsl:text>
  810       <xsl:call-template name="latex-newline"/>
  811     </xsl:if>
  812     <xsl:if test="contains(gvm:report()/filters/keywords/keyword[column='levels']/value, 'm') = false">
  813       <xsl:text>Issues with the threat level ``Medium'' are not shown.</xsl:text>
  814       <xsl:call-template name="latex-newline"/>
  815     </xsl:if>
  816     <xsl:if test="contains(gvm:report()/filters/keywords/keyword[column='levels']/value, 'l') = false">
  817       <xsl:text>Issues with the threat level ``Low'' are not shown.</xsl:text>
  818       <xsl:call-template name="latex-newline"/>
  819     </xsl:if>
  820     <xsl:if test="contains(gvm:report()/filters/keywords/keyword[column='levels']/value, 'g') = false">
  821       <xsl:text>Issues with the threat level ``Log'' are not shown.</xsl:text>
  822       <xsl:call-template name="latex-newline"/>
  823     </xsl:if>
  824     <xsl:if test="contains(gvm:report()/filters/keywords/keyword[column='levels']/value, 'd') = false">
  825       <xsl:text>Issues with the threat level ``Debug'' are not shown.</xsl:text>
  826       <xsl:call-template name="latex-newline"/>
  827     </xsl:if>
  828     <xsl:if test="contains(gvm:report()/filters/keywords/keyword[column='levels']/value, 'f') = false">
  829       <xsl:text>Issues with the threat level ``False Positive'' are not shown.</xsl:text>
  830       <xsl:call-template name="latex-newline"/>
  831     </xsl:if>
  832     <xsl:choose>
  833       <xsl:when test="gvm:report()/filters/keywords/keyword[column='min_qod']/value = 0">
  834       </xsl:when>
  835       <xsl:when test="string-length (gvm:report()/filters/keywords/keyword[column='min_qod']/value) > 0">
  836         <xsl:text>Only results with a minimum QoD of </xsl:text>
  837         <xsl:value-of select="gvm:report()/filters/keywords/keyword[column='min_qod']/value"/>
  838         <xsl:text> are shown.</xsl:text>
  839         <xsl:call-template name="latex-newline"/>
  840       </xsl:when>
  841       <xsl:otherwise>
  842         <xsl:text>Only results with a minimum QoD of 70 are shown.</xsl:text>
  843         <xsl:call-template name="latex-newline"/>
  844       </xsl:otherwise>
  845     </xsl:choose>
  846     <xsl:call-template name="latex-newline"/>
  847 
  848     <xsl:variable name="last" select="gvm:report()/results/@start + count(gvm:report()/results/result) - 1"/>
  849     <xsl:choose>
  850       <xsl:when test="$last = 0">
  851         <xsl:text>This report contains 0 results.</xsl:text>
  852       </xsl:when>
  853       <xsl:when test="$last = gvm:report()/results/@start">
  854         <xsl:text>This report contains result </xsl:text>
  855         <xsl:value-of select="$last"/>
  856         <xsl:text> of the </xsl:text>
  857         <xsl:value-of select="gvm:report()/result_count/filtered"/>
  858         <xsl:text> results selected by the</xsl:text>
  859         <xsl:text> filtering above.</xsl:text>
  860       </xsl:when>
  861       <xsl:when test="$last = gvm:report()/result_count/filtered">
  862         <xsl:text>This report contains all </xsl:text>
  863         <xsl:value-of select="gvm:report()/result_count/filtered"/>
  864         <xsl:text> results selected by the</xsl:text>
  865         <xsl:text> filtering described above.</xsl:text>
  866       </xsl:when>
  867       <xsl:otherwise>
  868         <xsl:text>This report contains results </xsl:text>
  869         <xsl:value-of select="gvm:report()/results/@start"/>
  870         <xsl:text> to </xsl:text>
  871         <xsl:value-of select="$last"/>
  872         <xsl:text> of the </xsl:text>
  873         <xsl:value-of select="gvm:report()/result_count/filtered"/>
  874         <xsl:text> results selected by the</xsl:text>
  875         <xsl:text> filtering described above.</xsl:text>
  876       </xsl:otherwise>
  877     </xsl:choose>
  878     <xsl:choose>
  879       <xsl:when test="gvm:report()/delta">
  880       </xsl:when>
  881       <xsl:otherwise>
  882         <xsl:text>  Before filtering there were </xsl:text>
  883         <xsl:value-of select="gvm:report()/result_count/text()"/>
  884         <xsl:text> results.</xsl:text>
  885       </xsl:otherwise>
  886     </xsl:choose>
  887 
  888     <xsl:choose>
  889       <xsl:when test="string-length(/report/host/detail[name='Auth-SSH-Success']/value) &gt; 0 or
  890         string-length(/report/host/detail[name='Auth-SSH-Failure']/value) &gt; 0 or
  891         string-length(/report/host/detail[name='Auth-SMB-Success']/value) &gt; 0 or
  892         string-length(/report/host/detail[name='Auth-SMB-Failure']/value) &gt; 0 or
  893         string-length(/report/host/detail[name='Auth-ESXi-Success']/value) &gt; 0 or
  894         string-length(/report/host/detail[name='Auth-ESXi-Failure']/value) &gt; 0">
  895         <xsl:call-template name="latex-subsection"><xsl:with-param name="subsection_string">Host Authentications</xsl:with-param></xsl:call-template>
  896         <xsl:text>\begin{longtable}{|l|l|l|l|}</xsl:text><xsl:call-template name="newline"/>
  897         <xsl:call-template name="latex-hline"/>
  898         <xsl:call-template name="longtable-continue-block">
  899           <xsl:with-param name="number-of-columns">4</xsl:with-param>
  900           <xsl:with-param name="header-color">gvm_report</xsl:with-param>
  901           <xsl:with-param name="header-text">Host&amp;Protocol&amp;Result&amp;Port/User</xsl:with-param>
  902         </xsl:call-template>
  903         <xsl:for-each select="host">
  904           <xsl:sort select="key('host-by-ip', host)/detail[name='hostname']/value/text()"/>
  905           <xsl:call-template name="auth-success-row"/>
  906         </xsl:for-each>
  907         <xsl:call-template name="latex-hline"/>
  908         <xsl:text>\end{longtable}</xsl:text><xsl:call-template name="newline"/>
  909       </xsl:when>
  910     </xsl:choose>
  911   </xsl:template>
  912 
  913   <!-- In Host-wise overview row in table. -->
  914   <xsl:template name="single-host-overview-table-row">
  915     <xsl:param name="threat"/>
  916     <xsl:param name="host"/>
  917     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
  918       <xsl:variable name="port_service" select="text()"/>
  919         <xsl:if test="gvm:report()/results/result[host/text()=$host][threat/text()=$threat][port=$port_service]">
  920           <xsl:call-template name="latex-hyperref">
  921             <xsl:with-param name="target" select="concat('port:', $host, ' ', $port_service, ' ', $threat)"/>
  922             <xsl:with-param name="text" select="$port_service"/>
  923           </xsl:call-template>
  924           <xsl:text>&amp;</xsl:text><xsl:value-of select="$threat"/><xsl:call-template name="latex-newline"/>
  925           <xsl:call-template name="latex-hline"/>
  926         </xsl:if>
  927     </xsl:for-each>
  928   </xsl:template>
  929 
  930   <!-- Overview table for subsect. of details of findings for a single host. -->
  931   <xsl:template name="results-per-host-single-host-port-findings">
  932     <xsl:variable name="host" select="ip"/>
  933     <xsl:text>\begin{longtable}{|l|l|}</xsl:text><xsl:call-template name="newline"/>
  934     <xsl:call-template name="latex-hline"/>
  935     <xsl:call-template name="longtable-continue-block">
  936       <xsl:with-param name="number-of-columns">2</xsl:with-param>
  937       <xsl:with-param name="header-color">gvm_report</xsl:with-param>
  938       <xsl:with-param name="header-text">Service (Port)&amp;Threat Level</xsl:with-param>
  939     </xsl:call-template>
  940     <xsl:call-template name="single-host-overview-table-row">
  941       <xsl:with-param name="threat">High</xsl:with-param>
  942       <xsl:with-param name="host" select="$host"/>
  943     </xsl:call-template>
  944     <xsl:call-template name="single-host-overview-table-row">
  945       <xsl:with-param name="threat">Medium</xsl:with-param>
  946       <xsl:with-param name="host" select="$host"/>
  947     </xsl:call-template>
  948     <xsl:call-template name="single-host-overview-table-row">
  949       <xsl:with-param name="threat">Low</xsl:with-param>
  950       <xsl:with-param name="host" select="$host"/>
  951     </xsl:call-template>
  952     <xsl:call-template name="single-host-overview-table-row">
  953       <xsl:with-param name="threat">Log</xsl:with-param>
  954       <xsl:with-param name="host" select="$host"/>
  955     </xsl:call-template>
  956     <xsl:call-template name="single-host-overview-table-row">
  957       <xsl:with-param name="threat">False Positive</xsl:with-param>
  958       <xsl:with-param name="host" select="$host"/>
  959     </xsl:call-template>
  960     <xsl:text>\end{longtable}</xsl:text><xsl:call-template name="newline"/>
  961   </xsl:template>
  962 
  963   <!-- Table of Closed CVEs for a single host. -->
  964   <xsl:template name="results-per-host-single-host-closed-cves">
  965     <xsl:variable name="cves" select="str:split(detail[name = 'Closed CVEs']/value, ',')"/>
  966     <xsl:choose>
  967       <xsl:when test="gvm:report()/@type = 'delta'">
  968       </xsl:when>
  969       <xsl:when test="gvm:report()/filters/keywords/keyword[column='show_closed_cves']/value = 1">
  970         <xsl:text>\begin{longtable}{|l|l|}</xsl:text><xsl:call-template name="newline"/>
  971         <xsl:call-template name="latex-hline"/>
  972         <xsl:call-template name="longtable-continue-block">
  973           <xsl:with-param name="number-of-columns">2</xsl:with-param>
  974           <xsl:with-param name="header-color">gvm_report</xsl:with-param>
  975           <xsl:with-param name="header-text">Closed CVE&amp;NVT</xsl:with-param>
  976         </xsl:call-template>
  977         <xsl:variable name="host" select="."/>
  978         <xsl:for-each select="$cves">
  979           <xsl:value-of select="."/>
  980           <xsl:text>&amp;</xsl:text>
  981           <xsl:variable name="cve" select="normalize-space(.)"/>
  982           <xsl:variable name="closed_cve"
  983                         select="$host/detail[name = 'Closed CVE' and contains(value, $cve)]"/>
  984           <xsl:value-of select="$closed_cve/source/description"/>
  985           <xsl:call-template name="latex-newline"/>
  986           <xsl:call-template name="latex-hline"/>
  987         </xsl:for-each>
  988         <xsl:text>\end{longtable}</xsl:text><xsl:call-template name="newline"/>
  989       </xsl:when>
  990     </xsl:choose>
  991   </xsl:template>
  992 
  993   <!-- Colors for threats. -->
  994   <xsl:template name="threat-to-color">
  995     <xsl:param name="threat"/>
  996     <xsl:choose>
  997       <xsl:when test="threat='High'">gvm_hole</xsl:when>
  998       <xsl:when test="threat='Medium'">gvm_warning</xsl:when>
  999       <xsl:when test="threat='Low'">gvm_note</xsl:when>
 1000       <xsl:when test="threat='Log'">gvm_log</xsl:when>
 1001       <xsl:when test="threat='False Positive'">gvm_log</xsl:when>
 1002     </xsl:choose>
 1003   </xsl:template>
 1004 
 1005   <!-- Text of threat, Log to empty string. -->
 1006   <xsl:template name="threat-to-severity">
 1007     <xsl:param name="threat"/>
 1008     <xsl:choose>
 1009       <xsl:when test="threat='Low'">Low</xsl:when>
 1010       <xsl:when test="threat='Medium'">Medium</xsl:when>
 1011       <xsl:when test="threat='High'">High</xsl:when>
 1012       <xsl:when test="threat='Log'"></xsl:when>
 1013       <!-- TODO False Positive -->
 1014     </xsl:choose>
 1015   </xsl:template>
 1016 
 1017   <!-- References box. -->
 1018   <xsl:template name="references">
 1019     <xsl:if test="count(nvt/refs/ref) &gt; 0">
 1020       \hline
 1021       <xsl:call-template name="latex-newline"/>
 1022       <xsl:text>\textbf{References}</xsl:text>
 1023       <xsl:call-template name="latex-newline"/>
 1024 
 1025       <xsl:for-each select="nvt/refs/ref">
 1026         <xsl:call-template name="text-to-escaped-row">
 1027           <xsl:with-param name="string" select="concat(@type, ': ', @id)"/>
 1028         </xsl:call-template>
 1029       </xsl:for-each>
 1030     </xsl:if>
 1031   </xsl:template>
 1032 
 1033   <!-- Text of a note. -->
 1034   <xsl:template name="notes">
 1035     <xsl:param name="delta">0</xsl:param>
 1036     <xsl:if test="count(notes/note [not (active='0')]) &gt; 0">
 1037       <xsl:call-template name="latex-hline"/>
 1038       <xsl:call-template name="latex-newline"/>
 1039     </xsl:if>
 1040     <xsl:for-each select="notes/note [not (active='0')]">
 1041       <xsl:call-template name="latex-newline"/>
 1042       <xsl:text>\rowcolor{gvm_user_note}{\textbf{Note}</xsl:text>
 1043       <xsl:if test="$delta and $delta &gt; 0"> (Result <xsl:value-of select="$delta"/>)</xsl:if>
 1044       <xsl:text>}</xsl:text>\\<xsl:call-template name="latex-newline"/>
 1045       <xsl:call-template name="text-to-escaped-row-color">
 1046         <xsl:with-param name="color" select="'gvm_user_note'"/>
 1047         <xsl:with-param name="string" select="text"/>
 1048       </xsl:call-template>
 1049       <xsl:text>\rowcolor{gvm_user_note}{}</xsl:text><xsl:call-template name="latex-newline"/>
 1050       <xsl:choose>
 1051         <xsl:when test="active='0'">
 1052         </xsl:when>
 1053         <xsl:when test="active='1' and string-length (end_time) &gt; 0">
 1054           <xsl:text>\rowcolor{gvm_user_note}{Active until: </xsl:text>
 1055           <xsl:call-template name="format-date">
 1056             <xsl:with-param name="date" select="end_time"/>
 1057           </xsl:call-template>
 1058           <xsl:text>}</xsl:text><xsl:call-template name="latex-newline"/>
 1059         </xsl:when>
 1060         <xsl:otherwise>
 1061         </xsl:otherwise>
 1062       </xsl:choose>
 1063       <xsl:text>\rowcolor{gvm_user_note}{Last modified: </xsl:text>
 1064       <xsl:call-template name="format-date">
 1065         <xsl:with-param name="date" select="modification_time"/>
 1066       </xsl:call-template>
 1067       <xsl:text>}</xsl:text><xsl:call-template name="latex-newline"/>
 1068     </xsl:for-each>
 1069   </xsl:template>
 1070 
 1071   <!-- Text of an override. -->
 1072   <xsl:template name="overrides">
 1073     <xsl:param name="delta">0</xsl:param>
 1074     <xsl:if test="gvm:report()/filters/apply_overrides/text()='1'">
 1075       <xsl:if test="count(overrides/override [not (active='0')]) &gt; 0">
 1076         <xsl:call-template name="latex-hline"/>
 1077         <xsl:call-template name="latex-newline"/>
 1078       </xsl:if>
 1079       <xsl:for-each select="overrides/override [not (active='0')]">
 1080         <xsl:call-template name="latex-newline"/>
 1081         <xsl:text>\rowcolor{gvm_user_override}{\textbf{Override from </xsl:text>
 1082         <xsl:choose>
 1083           <xsl:when test="string-length(threat) = 0">
 1084             <xsl:text>Any</xsl:text>
 1085           </xsl:when>
 1086           <xsl:otherwise>
 1087             <xsl:value-of select="threat"/>
 1088           </xsl:otherwise>
 1089         </xsl:choose>
 1090         <xsl:text> to </xsl:text>
 1091         <xsl:value-of select="new_threat"/><xsl:text>}</xsl:text>
 1092         <xsl:if test="$delta and $delta &gt; 0"> (Result <xsl:value-of select="$delta"/>)</xsl:if>
 1093         <xsl:text>}</xsl:text>\\<xsl:call-template name="latex-newline"/>
 1094         <xsl:call-template name="text-to-escaped-row-color">
 1095           <xsl:with-param name="color" select="'gvm_user_override'"/>
 1096           <xsl:with-param name="string" select="text"/>
 1097         </xsl:call-template>
 1098         <xsl:text>\rowcolor{gvm_user_override}{}</xsl:text><xsl:call-template name="latex-newline"/>
 1099         <xsl:choose>
 1100           <xsl:when test="active='0'">
 1101           </xsl:when>
 1102           <xsl:when test="active='1' and string-length (end_time) &gt; 0">
 1103             <xsl:text>\rowcolor{gvm_user_override}{Active until: </xsl:text>
 1104             <xsl:call-template name="format-date">
 1105               <xsl:with-param name="date" select="end_time"/>
 1106             </xsl:call-template>
 1107             <xsl:text>}</xsl:text><xsl:call-template name="latex-newline"/>
 1108           </xsl:when>
 1109           <xsl:otherwise>
 1110           </xsl:otherwise>
 1111         </xsl:choose>
 1112         <xsl:text>\rowcolor{gvm_user_override}{Last modified: </xsl:text>
 1113         <xsl:call-template name="format-date">
 1114           <xsl:with-param name="date" select="modification_time"/>
 1115         </xsl:call-template>
 1116         <xsl:text>}</xsl:text><xsl:call-template name="latex-newline"/>
 1117       </xsl:for-each>
 1118     </xsl:if>
 1119   </xsl:template>
 1120 
 1121 <!-- SUBSECTION: Results for a single host. -->
 1122 
 1123   <!-- Overview table for a single host -->
 1124   <xsl:template name="result-details-host-port-threat">
 1125     <xsl:param name="host"/>
 1126     <xsl:param name="port_service"/>
 1127     <xsl:param name="threat"/>
 1128     <xsl:if test="gvm:report()/results/result[host/text()=$host][threat/text()=$threat][port=$port_service]">
 1129       <xsl:call-template name="latex-subsubsection"><xsl:with-param name="subsubsection_string" select="concat ($threat, ' ', $port_service)"/></xsl:call-template>
 1130       <xsl:call-template name="latex-label"><xsl:with-param name="label_string" select="concat('port:', $host, ' ', $port_service, ' ', $threat)"/></xsl:call-template>
 1131       <xsl:call-template name="newline"/>
 1132       <xsl:for-each select="gvm:report()/results/result[host/text()=$host][threat/text()=$threat][port=$port_service]">
 1133         <xsl:text>\begin{longtable}{|p{\textwidth * 1}|}</xsl:text><xsl:call-template name="newline"/>
 1134         <xsl:call-template name="latex-hline"/>
 1135         <xsl:text>\rowcolor{</xsl:text>
 1136         <xsl:call-template name="threat-to-color">
 1137           <xsl:with-param name="threat" select="$threat" />
 1138         </xsl:call-template>
 1139         <xsl:text>}{\color{white}{</xsl:text>
 1140         <xsl:if test="delta/text()">
 1141           <xsl:text>\vspace{3pt}</xsl:text>
 1142           <xsl:text>\hspace{3pt}</xsl:text>
 1143           <xsl:choose>
 1144             <xsl:when test="delta/text() = 'changed'">\begin{LARGE}\sim\end{LARGE}</xsl:when>
 1145             <xsl:when test="delta/text() = 'gone'">\begin{LARGE}&#8722;\end{LARGE}</xsl:when>
 1146             <xsl:when test="delta/text() = 'new'">\begin{LARGE}+\end{LARGE}</xsl:when>
 1147             <xsl:when test="delta/text() = 'same'">\begin{LARGE}=\end{LARGE}</xsl:when>
 1148           </xsl:choose>
 1149           <xsl:text>\hspace{3pt}</xsl:text>
 1150         </xsl:if>
 1151         <xsl:value-of select="$threat"/>
 1152         <xsl:choose>
 1153           <xsl:when test="original_threat">
 1154             <xsl:choose>
 1155               <xsl:when test="threat = original_threat">
 1156                 <xsl:if test="string-length(nvt/cvss_base) &gt; 0">
 1157                   <xsl:text> (CVSS: </xsl:text>
 1158                   <xsl:value-of select="nvt/cvss_base"/>
 1159                   <xsl:text>) </xsl:text>
 1160                 </xsl:if>
 1161               </xsl:when>
 1162               <xsl:otherwise>
 1163                 <xsl:text> (Overridden from </xsl:text>
 1164                 <xsl:value-of select="original_threat"/>
 1165                 <xsl:text>) </xsl:text>
 1166               </xsl:otherwise>
 1167             </xsl:choose>
 1168           </xsl:when>
 1169           <xsl:otherwise>
 1170             <xsl:if test="string-length(nvt/cvss_base) &gt; 0">
 1171               <xsl:text> (CVSS: </xsl:text>
 1172               <xsl:value-of select="nvt/cvss_base"/>
 1173               <xsl:text>) </xsl:text>
 1174             </xsl:if>
 1175           </xsl:otherwise>
 1176         </xsl:choose>
 1177         <xsl:text>}}</xsl:text>
 1178         <xsl:call-template name="latex-newline"/>
 1179         <xsl:text>\rowcolor{</xsl:text>
 1180         <xsl:call-template name="threat-to-color">
 1181           <xsl:with-param name="threat" select="$threat"/>
 1182         </xsl:call-template>
 1183         <xsl:text>}{\color{white}{NVT: </xsl:text>
 1184         <xsl:variable name="name_escaped"><xsl:call-template name="escape_text"><xsl:with-param name="string" select="nvt/name"/></xsl:call-template></xsl:variable>
 1185         <xsl:value-of select="$name_escaped"/>
 1186         <xsl:text>}}</xsl:text>
 1187         <xsl:call-template name="latex-newline"/>
 1188         <xsl:call-template name="latex-hline"/>
 1189         <xsl:text>\endfirsthead</xsl:text><xsl:call-template name="newline"/>
 1190         <xsl:text>\hfill\ldots continued from previous page \ldots </xsl:text><xsl:call-template name="latex-newline"/>
 1191         <xsl:call-template name="latex-hline"/>
 1192         <xsl:text>\endhead</xsl:text><xsl:call-template name="newline"/>
 1193         <xsl:call-template name="latex-hline"/>
 1194         <xsl:text>\ldots continues on next page \ldots </xsl:text><xsl:call-template name="latex-newline"/>
 1195         <xsl:text>\endfoot</xsl:text><xsl:call-template name="newline"/>
 1196         <xsl:call-template name="latex-hline"/>
 1197         <xsl:text>\endlastfoot</xsl:text><xsl:call-template name="newline"/>
 1198 
 1199         <xsl:if test="count (detection)">
 1200           <xsl:call-template name="latex-newline"/>
 1201           <xsl:text>\textbf{Product detection result}</xsl:text>
 1202           <xsl:call-template name="latex-newline"/>
 1203           <xsl:call-template name="text-to-escaped-row">
 1204             <xsl:with-param name="string" select="detection/result/details/detail[name = 'product']/value/text()"/>
 1205           </xsl:call-template>
 1206           <xsl:call-template name="text-to-escaped-row">
 1207             <xsl:with-param name="string" select="concat('Detected by ', detection/result/details/detail[name = 'source_name']/value/text(), ' (OID: ', detection/result/details/detail[name = 'source_oid']/value/text(), ')')"/>
 1208           </xsl:call-template>
 1209           <xsl:call-template name="latex-newline"/>
 1210           <xsl:call-template name="latex-hline"/>
 1211         </xsl:if>
 1212 
 1213         <!-- Summary -->
 1214         <xsl:if test="string-length (gvm:get-nvt-tag (nvt/tags, 'summary')) &gt; 0">
 1215           <xsl:call-template name="latex-newline"/>
 1216           <xsl:text>\textbf{Summary}</xsl:text>
 1217           <xsl:call-template name="latex-newline"/>
 1218           <xsl:call-template name="structured-text">
 1219             <xsl:with-param name="string" select="gvm:get-nvt-tag (nvt/tags, 'summary')"/>
 1220           </xsl:call-template>
 1221         </xsl:if>
 1222 
 1223         <!-- Result -->
 1224         <xsl:choose>
 1225           <xsl:when test="delta/text() = 'changed'">
 1226             <xsl:call-template name="latex-newline"/>
 1227             <xsl:text>\textbf{Result 1}</xsl:text>
 1228             <xsl:call-template name="latex-newline"/>
 1229           </xsl:when>
 1230         </xsl:choose>
 1231         \hline
 1232         <xsl:call-template name="latex-newline"/>
 1233         <xsl:text>\textbf{Vulnerability Detection Result}</xsl:text>
 1234         <xsl:call-template name="latex-newline"/>
 1235         <xsl:choose>
 1236           <xsl:when test="string-length(description) &lt; 2">
 1237             <xsl:text>Vulnerability was detected according to the Vulnerability Detection Method.</xsl:text>
 1238             <xsl:call-template name="latex-newline"/>
 1239           </xsl:when>
 1240           <xsl:otherwise>
 1241             <xsl:call-template name="text-to-escaped-row">
 1242               <xsl:with-param name="string" select="description"/>
 1243             </xsl:call-template>
 1244           </xsl:otherwise>
 1245         </xsl:choose>
 1246 
 1247         <xsl:if test="string-length (gvm:get-nvt-tag (nvt/tags, 'impact')) &gt; 0 and gvm:get-nvt-tag (nvt/tags, 'impact') != 'N/A'">
 1248           \hline
 1249           <xsl:call-template name="latex-newline"/>
 1250           <xsl:text>\textbf{Impact}</xsl:text>
 1251           <xsl:call-template name="latex-newline"/>
 1252           <xsl:call-template name="structured-text">
 1253             <xsl:with-param name="string" select="gvm:get-nvt-tag (nvt/tags, 'impact')"/>
 1254           </xsl:call-template>
 1255         </xsl:if>
 1256 
 1257         <xsl:if test="(string-length (gvm:get-nvt-tag (nvt/tags, 'solution')) &gt; 0 and gvm:get-nvt-tag (nvt/tags, 'solution') != 'N/A') or (string-length (gvm:get-nvt-tag (nvt/tags, 'solution_type')) &gt; 0)">
 1258           \hline
 1259           <xsl:call-template name="latex-newline"/>
 1260           <xsl:text>\textbf{Solution}</xsl:text>
 1261           <xsl:call-template name="latex-newline"/>
 1262           <xsl:if test="string-length (gvm:get-nvt-tag (nvt/tags, 'solution_type')) &gt; 0">
 1263             \textbf{Solution type:}
 1264             <xsl:value-of select="gvm:get-nvt-tag (nvt/tags, 'solution_type')"/>
 1265             <xsl:call-template name="latex-newline"/>
 1266           </xsl:if>
 1267           <xsl:call-template name="structured-text">
 1268             <xsl:with-param name="string" select="gvm:get-nvt-tag (nvt/tags, 'solution')"/>
 1269           </xsl:call-template>
 1270         </xsl:if>
 1271 
 1272         <xsl:if test="string-length (gvm:get-nvt-tag (nvt/tags, 'affected')) &gt; 0 and gvm:get-nvt-tag (nvt/tags, 'affected') != 'N/A'">
 1273           \hline
 1274           <xsl:call-template name="latex-newline"/>
 1275           <xsl:text>\textbf{Affected Software/OS}</xsl:text>
 1276           <xsl:call-template name="latex-newline"/>
 1277           <xsl:call-template name="structured-text">
 1278             <xsl:with-param name="string" select="gvm:get-nvt-tag (nvt/tags, 'affected')"/>
 1279           </xsl:call-template>
 1280         </xsl:if>
 1281 
 1282         <xsl:if test="string-length (gvm:get-nvt-tag (nvt/tags, 'insight')) &gt; 0 and gvm:get-nvt-tag (nvt/tags, 'insight') != 'N/A'">
 1283           \hline
 1284           <xsl:call-template name="latex-newline"/>
 1285           <xsl:text>\textbf{Vulnerability Insight}</xsl:text>
 1286           <xsl:call-template name="latex-newline"/>
 1287           <xsl:call-template name="structured-text">
 1288             <xsl:with-param name="string" select="gvm:get-nvt-tag (nvt/tags, 'insight')"/>
 1289           </xsl:call-template>
 1290         </xsl:if>
 1291 
 1292         \hline
 1293         <xsl:call-template name="latex-newline"/>
 1294         <xsl:choose>
 1295           <xsl:when test="(nvt/cvss_base &gt; 0) or (cve/cvss_base &gt; 0)">
 1296             <xsl:text>\textbf{Vulnerability Detection Method}</xsl:text>
 1297           </xsl:when>
 1298           <xsl:otherwise>
 1299             <xsl:text>\textbf{Log Method}</xsl:text>
 1300           </xsl:otherwise>
 1301         </xsl:choose>
 1302         <xsl:call-template name="latex-newline"/>
 1303         <xsl:call-template name="structured-text">
 1304           <xsl:with-param name="string" select="gvm:get-nvt-tag (nvt/tags, 'vuldetect')"/>
 1305         </xsl:call-template>
 1306 
 1307         <xsl:text>Details:</xsl:text><xsl:call-template name="newline"/>
 1308         <xsl:choose>
 1309           <xsl:when test="nvt/@oid = 0">
 1310             <xsl:if test="delta/text()">
 1311               <xsl:call-template name="latex-newline"/>
 1312             </xsl:if>
 1313           </xsl:when>
 1314           <xsl:otherwise>
 1315             <xsl:variable name="max" select="80"/>
 1316             <xsl:choose>
 1317               <xsl:when test="string-length(nvt/name) &gt; $max">
 1318                 <xsl:call-template name="text-to-escaped-row">
 1319                   <xsl:with-param name="string" select="concat (substring(nvt/name, 0, $max), '...')"/>
 1320                 </xsl:call-template>
 1321               </xsl:when>
 1322               <xsl:otherwise>
 1323                 <xsl:call-template name="text-to-escaped-row">
 1324                   <xsl:with-param name="string" select="nvt/name"/>
 1325                 </xsl:call-template>
 1326               </xsl:otherwise>
 1327             </xsl:choose>
 1328             <xsl:text>OID:</xsl:text>
 1329             <xsl:value-of select="nvt/@oid"/>
 1330           </xsl:otherwise>
 1331         </xsl:choose>
 1332         <xsl:if test="scan_nvt_version != ''">
 1333           <xsl:call-template name="latex-newline"/>
 1334           <xsl:text>Version used:</xsl:text><xsl:call-template name="newline"/>
 1335           <xsl:call-template name="text-to-escaped-row">
 1336             <xsl:with-param name="string" select="scan_nvt_version"/>
 1337           </xsl:call-template>
 1338         </xsl:if>
 1339 
 1340         <xsl:if test="count (detection)">
 1341           \hline
 1342           <xsl:call-template name="latex-newline"/>
 1343           <xsl:text>\textbf{Product Detection Result}</xsl:text>
 1344           <xsl:call-template name="latex-newline"/>
 1345           <xsl:text>Product:</xsl:text><xsl:call-template name="newline"/>
 1346           <xsl:call-template name="text-to-escaped-row">
 1347             <xsl:with-param name="string" select="detection/result/details/detail[name = 'product']/value/text()"/>
 1348           </xsl:call-template>
 1349           <xsl:text>Method:</xsl:text><xsl:call-template name="newline"/>
 1350           <xsl:call-template name="text-to-escaped-row">
 1351             <xsl:with-param name="string" select="detection/result/details/detail[name = 'source_name']/value/text()"/>
 1352           </xsl:call-template>
 1353           OID:
 1354           <xsl:value-of select="detection/result/details/detail[name = 'source_oid']/value/text()"/>)
 1355         </xsl:if>
 1356 
 1357         <xsl:if test="delta">
 1358           <xsl:choose>
 1359             <xsl:when test="delta/text() = 'changed'">
 1360 
 1361               <xsl:call-template name="latex-hline"/>
 1362               <xsl:call-template name="latex-newline"/>
 1363               <xsl:text>\textbf{Result 2}</xsl:text>
 1364               <xsl:call-template name="latex-newline"/>
 1365               <xsl:call-template name="latex-newline"/>
 1366               <xsl:call-template name="text-to-escaped-row">
 1367                 <xsl:with-param name="string" select="delta/result/description"/>
 1368               </xsl:call-template>
 1369               <xsl:text>\rowcolor{white}{\verb==}</xsl:text><xsl:call-template name="latex-newline"/>
 1370               <xsl:text>\rowcolor{white}{\verb==}</xsl:text><xsl:call-template name="latex-newline"/>
 1371               <xsl:call-template name="latex-newline"/>
 1372               <xsl:text>OID of test routine: </xsl:text><xsl:value-of select="delta/result/nvt/@oid"/>
 1373               <xsl:call-template name="latex-newline"/>
 1374 
 1375               <xsl:call-template name="latex-hline"/>
 1376               <xsl:call-template name="latex-newline"/>
 1377               <xsl:text>\textbf{Different Lines}</xsl:text>
 1378               <xsl:call-template name="latex-newline"/>
 1379               <xsl:call-template name="latex-newline"/>
 1380               <xsl:call-template name="text-to-escaped-diff-row">
 1381                 <xsl:with-param name="string" select="delta/diff"/>
 1382               </xsl:call-template>
 1383               <xsl:call-template name="latex-newline"/>
 1384             </xsl:when>
 1385           </xsl:choose>
 1386         </xsl:if>
 1387         <xsl:call-template name="references"/>
 1388         <xsl:variable name="delta">
 1389           <xsl:choose>
 1390             <xsl:when test="delta">1</xsl:when>
 1391             <xsl:otherwise>0</xsl:otherwise>
 1392           </xsl:choose>
 1393         </xsl:variable>
 1394         <xsl:call-template name="notes">
 1395           <xsl:with-param name="delta" select="$delta"/>
 1396         </xsl:call-template>
 1397         <xsl:for-each select="delta">
 1398           <xsl:call-template name="notes">
 1399             <xsl:with-param name="delta" select="2"/>
 1400           </xsl:call-template>
 1401         </xsl:for-each>
 1402         <xsl:call-template name="overrides">
 1403           <xsl:with-param name="delta" select="$delta"/>
 1404         </xsl:call-template>
 1405         <xsl:for-each select="delta">
 1406           <xsl:call-template name="overrides">
 1407             <xsl:with-param name="delta" select="2"/>
 1408           </xsl:call-template>
 1409         </xsl:for-each>
 1410         <xsl:text>\end{longtable}</xsl:text>
 1411         <xsl:call-template name="newline"/>
 1412         <xsl:call-template name="newline"/>
 1413       </xsl:for-each>
 1414 
 1415       <xsl:text>\begin{footnotesize}</xsl:text>
 1416       <xsl:call-template name="latex-hyperref">
 1417         <xsl:with-param name="target" select="concat('host:', $host)"/>
 1418         <xsl:with-param name="text" select="concat('[ return to ', $host, ' ]')"/>
 1419       </xsl:call-template>
 1420 
 1421       <xsl:text>\end{footnotesize}</xsl:text><xsl:call-template name="newline"/>
 1422     </xsl:if>
 1423   </xsl:template>
 1424 
 1425   <!-- Findings for a single host -->
 1426   <xsl:template name="results-per-host-single-host-findings">
 1427     <xsl:param name="host"/>
 1428 
 1429     <!-- TODO Solve other sorting possibilities. -->
 1430     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
 1431       <xsl:call-template name="result-details-host-port-threat">
 1432         <xsl:with-param name="threat">High</xsl:with-param>
 1433         <xsl:with-param name="host" select="$host"/>
 1434         <xsl:with-param name="port_service" select="text()"/>
 1435       </xsl:call-template>
 1436     </xsl:for-each>
 1437 
 1438     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
 1439       <xsl:call-template name="result-details-host-port-threat">
 1440         <xsl:with-param name="threat">Medium</xsl:with-param>
 1441         <xsl:with-param name="host" select="$host"/>
 1442         <xsl:with-param name="port_service" select="text()"/>
 1443       </xsl:call-template>
 1444     </xsl:for-each>
 1445 
 1446     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
 1447       <xsl:call-template name="result-details-host-port-threat">
 1448         <xsl:with-param name="threat">Low</xsl:with-param>
 1449         <xsl:with-param name="host" select="$host"/>
 1450         <xsl:with-param name="port_service" select="text()"/>
 1451       </xsl:call-template>
 1452     </xsl:for-each>
 1453 
 1454     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
 1455       <xsl:call-template name="result-details-host-port-threat">
 1456         <xsl:with-param name="threat">Log</xsl:with-param>
 1457         <xsl:with-param name="host" select="$host"/>
 1458         <xsl:with-param name="port_service" select="text()"/>
 1459       </xsl:call-template>
 1460     </xsl:for-each>
 1461 
 1462     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
 1463       <xsl:call-template name="result-details-host-port-threat">
 1464         <xsl:with-param name="threat">Debug</xsl:with-param>
 1465         <xsl:with-param name="host" select="$host"/>
 1466         <xsl:with-param name="port_service" select="text()"/>
 1467       </xsl:call-template>
 1468     </xsl:for-each>
 1469 
 1470     <xsl:for-each select="gvm:report()/ports/port[host/text()=$host]">
 1471       <xsl:call-template name="result-details-host-port-threat">
 1472         <xsl:with-param name="threat">False Positive</xsl:with-param>
 1473         <xsl:with-param name="host" select="$host"/>
 1474         <xsl:with-param name="port_service" select="text()"/>
 1475       </xsl:call-template>
 1476     </xsl:for-each>
 1477   </xsl:template>
 1478 
 1479   <!-- Subsection for a single host, with all details. -->
 1480   <xsl:template name="results-per-host-single-host">
 1481     <xsl:variable name="host" select="ip"/>
 1482     <xsl:call-template name="latex-subsection">
 1483       <xsl:with-param name="subsection_string" select="$host"/>
 1484     </xsl:call-template>
 1485     <xsl:call-template name="latex-label">
 1486       <xsl:with-param name="label_string" select="concat('host:', $host)"/>
 1487     </xsl:call-template>
 1488     <xsl:call-template name="newline"/>
 1489 
 1490     <xsl:text>\begin{tabular}{ll}</xsl:text><xsl:call-template name="newline"/>
 1491     <xsl:text>Host scan start&amp;</xsl:text>
 1492     <xsl:call-template name="format-date">
 1493       <xsl:with-param name="date" select="start"/>
 1494     </xsl:call-template>
 1495     <xsl:call-template name="latex-newline"/>
 1496     <xsl:text>Host scan end&amp;</xsl:text>
 1497     <xsl:call-template name="format-date">
 1498       <xsl:with-param name="date" select="end"/>
 1499     </xsl:call-template>
 1500     <xsl:call-template name="latex-newline"/>
 1501     <xsl:text>\end{tabular}</xsl:text><xsl:call-template name="newline"/>
 1502     <xsl:call-template name="newline"/>
 1503     <xsl:call-template name="results-per-host-single-host-port-findings"/>
 1504     <xsl:call-template name="newline"/>
 1505     <xsl:call-template name="results-per-host-single-host-closed-cves"/>
 1506     <xsl:call-template name="newline"/>
 1507 
 1508     <xsl:text>%\subsection*{Security Issues and Fixes -- </xsl:text><xsl:value-of select="$host"/><xsl:text>}</xsl:text>
 1509     <xsl:call-template name="newline"/>
 1510     <xsl:call-template name="newline"/>
 1511     <xsl:call-template name="results-per-host-single-host-findings"><xsl:with-param name="host" select="$host"/></xsl:call-template>
 1512   </xsl:template>
 1513 
 1514   <!-- Section with Results per Host. -->
 1515   <xsl:template name="results-per-host">
 1516     <xsl:text>\section{Results per Host}</xsl:text>
 1517     <xsl:call-template name="newline"/><xsl:call-template name="newline"/>
 1518     <xsl:for-each select="host">
 1519       <xsl:call-template name="results-per-host-single-host"/>
 1520     </xsl:for-each>
 1521   </xsl:template>
 1522 
 1523   <!-- The actual report. -->
 1524   <xsl:template name="real-report">
 1525     <xsl:call-template name="header"/>
 1526     <xsl:call-template name="newline"/>
 1527     <xsl:text>\begin{document}</xsl:text><xsl:call-template name="newline"/>
 1528     <xsl:call-template name="newline"/>
 1529     <xsl:text>\maketitle</xsl:text><xsl:call-template name="newline"/>
 1530     <xsl:call-template name="abstract"/>
 1531     <xsl:call-template name="toc"/>
 1532     <xsl:text>\newpage</xsl:text>
 1533     <xsl:call-template name="newline"/>
 1534     <xsl:call-template name="results-overview"/>
 1535     <xsl:call-template name="results-per-host"/>
 1536     <xsl:text>
 1537 \begin{center}
 1538 \medskip
 1539 \rule{\textwidth}{0.1pt}
 1540 
 1541 This file was automatically generated.
 1542 \end{center}
 1543 
 1544 \end{document}
 1545 </xsl:text>
 1546   </xsl:template>
 1547 
 1548   <!-- The first report element. -->
 1549   <xsl:template match="report">
 1550     <xsl:choose>
 1551       <xsl:when test="@extension='xml'">
 1552         <xsl:apply-templates select="report"/>
 1553       </xsl:when>
 1554       <xsl:otherwise>
 1555         <xsl:call-template name="real-report"/>
 1556       </xsl:otherwise>
 1557     </xsl:choose>
 1558   </xsl:template>
 1559 
 1560   <!-- Match the root. -->
 1561   <xsl:template match="/">
 1562     <xsl:apply-templates/>
 1563   </xsl:template>
 1564 
 1565 </xsl:stylesheet>