html report

This commit is contained in:
skyanth
2019-06-04 13:58:12 +02:00
parent b0dfb8fff7
commit 3b39dd4bfc
19 changed files with 2822 additions and 757 deletions

View File

@@ -68,86 +68,6 @@
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="unsortedFindingSummaryTable">
<xsl:for-each-group select="//finding" group-by="@threatLevel">
<xsl:for-each select="current-group()">
<findingEntry>
<xsl:attribute name="Ref">
<xsl:value-of select="@Ref"/>
</xsl:attribute>
<xsl:attribute name="status">
<xsl:value-of select="@status"/>
</xsl:attribute>
<xsl:attribute name="findingId">
<xsl:value-of select="@id"/>
</xsl:attribute>
<findingNumber>
<xsl:apply-templates select="." mode="number"/>
</findingNumber>
<findingType>
<xsl:value-of select="@type"/>
</findingType>
<findingDescription>
<xsl:choose>
<xsl:when test="description_summary">
<xsl:value-of select="description_summary"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="description" mode="summarytable"/>
</xsl:otherwise>
</xsl:choose>
</findingDescription>
<findingThreatLevel>
<xsl:value-of select="current-grouping-key()"/>
</findingThreatLevel>
</findingEntry>
</xsl:for-each>
</xsl:for-each-group>
</xsl:variable>
<xsl:variable name="findingSummaryTable">
<xsl:for-each select="$unsortedFindingSummaryTable/findingEntry">
<xsl:sort data-type="number" order="descending"
select="
(number(findingThreatLevel = 'Extreme') * 10)
+ (number(findingThreatLevel = 'High') * 9)
+ (number(findingThreatLevel = 'Elevated') * 8)
+ (number(findingThreatLevel = 'Moderate') * 7)
+ (number(findingThreatLevel = 'Low') * 6)
+ (number(findingThreatLevel = 'Unknown') * 3)
+ (number(findingThreatLevel = 'N/A') * 1)"/>
<xsl:variable name="findingThreatLevelClean"
select="translate(findingThreatLevel, '/', '_')"/>
<findingEntry>
<xsl:attribute name="Ref">
<xsl:value-of select="@Ref"/>
</xsl:attribute>
<xsl:attribute name="status">
<xsl:value-of select="@status"/>
</xsl:attribute>
<xsl:attribute name="findingId">
<xsl:value-of select="@findingId"/>
</xsl:attribute>
<!-- add an id for the first entry of each type so that we can link to it -->
<xsl:if
test="not(preceding-sibling::findingEntry/findingThreatLevel = findingThreatLevel)">
<xsl:attribute name="id">summaryTableThreatLevel<xsl:value-of
select="$findingThreatLevelClean"/></xsl:attribute>
</xsl:if>
<findingNumber>
<xsl:value-of select="findingNumber"/>
</findingNumber>
<findingType>
<xsl:value-of select="findingType"/>
</findingType>
<findingDescription>
<xsl:value-of select="findingDescription"/>
</findingDescription>
<findingThreatLevel>
<xsl:value-of select="findingThreatLevel"/>
</findingThreatLevel>
</findingEntry>
</xsl:for-each>
</xsl:variable>
<fo:block>
<fo:table xsl:use-attribute-sets="fwtable table borders">
<xsl:call-template name="checkIfLast"/>
@@ -214,6 +134,7 @@
</xsl:if>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<!-- attach id to first finding of each threatLevel so pie charts can link to it -->
<xsl:if test="@id">
<xsl:attribute name="id">
<xsl:value-of select="@id"/>

631
xml/xslt/css.xslt Normal file
View File

@@ -0,0 +1,631 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template name="css">
/*@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
font-display: swap;
src: local('Open Sans Regular'), local('OpenSans-Regular');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
*/
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined for any HTML5 element in IE 8/9.
* Correct `block` display not defined for `details` or `summary` in IE 10/11
* and Firefox.
* Correct `block` display not defined for `main` in IE 11.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
/**
* 1. Correct `inline-block` display not defined in IE 8/9.
* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
*/
audio,
canvas,
progress,
video {
display: inline-block; /* 1 */
vertical-align: baseline; /* 2 */
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9/10.
* Hide the `template` element in IE 8/9/11, Safari, and Firefox &lt; 22.
*/
[hidden],
template {
display: none;
}
/* Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* Text-level semantics
========================================================================== */
/**
* Address styling not present in IE 8/9/10/11, Safari, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
*/
b,
strong,
.topLevelToCEntry {
font-weight: bold;
}
/**
* Address styling not present in Safari and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9/10.
*/
img {
border: 0;
}
/**
* Correct overflow not hidden in IE 9/10/11.
*/
svg:not(:root) {
overflow: hidden;
}
/* Grouping content
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari.
*/
figure {
margin: 1em 40px;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Contain overflow in all browsers.
*/
pre {
overflow: auto;
}
/**
* Address odd `em`-unit font size rendering in all browsers.
*/
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
/* Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
/*
* Skeleton V2.0.4
* Copyright 2014, Dave Gamache
* www.getskeleton.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
* 12/29/2014
*/
/* Table of contents
- Grid
- Base Styles
- Typography
- Links
- Buttons
- Forms
- Lists
- Code
- Tables
- Spacing
- Utilities
- Clearing
- Media Queries
*/
/* Grid
*/
.container {
position: relative;
width: 100%;
max-width: 960px;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box; }
.column,
.columns {
width: 100%;
float: left;
box-sizing: border-box; }
body > div.section {
border-bottom: 1px solid <xsl:value-of select="$c_support_light"/>;
padding: 4rem 0;
margin-top: 0;}
/* For devices larger than 400px */
@media (min-width: 400px) {
.container {
width: 85%;
padding: 0; }
}
/* For devices larger than 550px */
@media (min-width: 550px) {
.container {
width: 80%; }
.column,
.columns {
margin-left: 4%; }
.column:first-child,
.columns:first-child {
margin-left: 0; }
.one.column,
.one.columns { width: 4.66666666667%; }
.two.columns { width: 13.3333333333%; }
.three.columns { width: 22%; }
.four.columns { width: 30.6666666667%; }
.five.columns { width: 39.3333333333%; }
.six.columns { width: 48%; }
.seven.columns { width: 56.6666666667%; }
.eight.columns { width: 65.3333333333%; }
.nine.columns { width: 74.0%; }
.ten.columns { width: 82.6666666667%; }
.eleven.columns { width: 91.3333333333%; }
.twelve.columns { width: 100%; margin-left: 0; }
.one-third.column { width: 30.6666666667%; }
.two-thirds.column { width: 65.3333333333%; }
.one-half.column { width: 48%; }
/* Offsets */
.offset-by-one.column,
.offset-by-one.columns { margin-left: 8.66666666667%; }
.offset-by-two.column,
.offset-by-two.columns { margin-left: 17.3333333333%; }
.offset-by-three.column,
.offset-by-three.columns { margin-left: 26%; }
.offset-by-four.column,
.offset-by-four.columns { margin-left: 34.6666666667%; }
.offset-by-five.column,
.offset-by-five.columns { margin-left: 43.3333333333%; }
.offset-by-six.column,
.offset-by-six.columns { margin-left: 52%; }
.offset-by-seven.column,
.offset-by-seven.columns { margin-left: 60.6666666667%; }
.offset-by-eight.column,
.offset-by-eight.columns { margin-left: 69.3333333333%; }
.offset-by-nine.column,
.offset-by-nine.columns { margin-left: 78.0%; }
.offset-by-ten.column,
.offset-by-ten.columns { margin-left: 86.6666666667%; }
.offset-by-eleven.column,
.offset-by-eleven.columns { margin-left: 95.3333333333%; }
.offset-by-one-third.column,
.offset-by-one-third.columns { margin-left: 34.6666666667%; }
.offset-by-two-thirds.column,
.offset-by-two-thirds.columns { margin-left: 69.3333333333%; }
.offset-by-one-half.column,
.offset-by-one-half.columns { margin-left: 52%; }
}
/* Base Styles
*/
/* NOTE
html is set to 62.5% so that all the REM measurements throughout Skeleton
are based on 10px sizing. So basically 1.5rem = 15px :) */
html {
font-size: 62.5%; }
body {
font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.6;
font-weight: 400;
font-family: "Open Sans", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
color: <xsl:value-of select="$c_support_dark"/>; }
/* Typography
*/
h1, h2, h3, h4, h5, h6 {
margin-top: 0;
margin-bottom: 2rem;
font-weight: 300; }
h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;}
h2 { font-size: 3.6rem; line-height: 1.25; letter-spacing: -.1rem; }
h3 { font-size: 3.0rem; line-height: 1.3; letter-spacing: -.1rem; }
h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; }
h5 { font-size: 1.8rem; line-height: 1.5; letter-spacing: -.05rem; }
h6 { font-size: 1.5rem; line-height: 1.6; letter-spacing: 0; }
/* Larger than phablet */
@media (min-width: 550px) {
h1 { font-size: 5.0rem; }
h2 { font-size: 4.2rem; }
h3 { font-size: 3.6rem; }
h4 { font-size: 3.0rem; }
h5 { font-size: 2.4rem; }
h6 { font-size: 1.5rem; }
}
p {
margin-top: 0; }
/* Links
*/
a {
color: <xsl:value-of select="$c_main"/>; }
a:hover {
color: <xsl:value-of select="$c_support_medium"/>; }
/* Lists
*/
ul {
list-style: circle inside; }
ol {
list-style: decimal inside; }
ol, ul {
padding-left: 0;
margin-top: 0; }
ul ul,
ul ol,
ol ol,
ol ul {
margin: 1.5rem 0 1.5rem 3rem;
font-size: 90%; }
li {
margin-bottom: 1rem; }
/* Code
*/
code {
padding: .2rem .5rem;
margin: 0 .2rem;
font-size: 90%;
white-space: nowrap;
background: <xsl:value-of select="$c_support_light"/>;
border: 1px solid <xsl:value-of select="$c_support_subtlydarkerlight"/>;
border-radius: 4px; }
pre {
background: <xsl:value-of select="$c_support_light"/>;
border: 1px solid <xsl:value-of select="$c_support_subtlydarkerlight"/>;
}
pre > code {
display: block;
padding: 1rem 1.5rem;
white-space: pre; }
/* Tables
*/
th,
td {
padding: 12px 15px;
text-align: left;
vertical-align: top;
border-bottom: 1px solid <xsl:value-of select="$c_support_medium"/>; }
th:first-child,
td:first-child {
padding-left: 0; }
th:last-child,
td:last-child {
padding-right: 0; }
th {background-color: }
/* Spacing
*/
button,
.button {
margin-bottom: 1rem; }
input,
textarea,
select,
fieldset {
margin-bottom: 1.5rem; }
pre,
blockquote,
dl,
figure,
table,
p,
ul,
ol,
form {
margin-bottom: 2.5rem; }
/* Utilities
*/
.u-full-width {
width: 100%;
box-sizing: border-box; }
.u-max-full-width {
max-width: 100%;
box-sizing: border-box; }
.u-pull-right {
float: right; }
.u-pull-left {
float: left; }
/* Misc
*/
hr {
margin-top: 3rem;
margin-bottom: 3.5rem;
border-width: 0;
border-top: 1px solid <xsl:value-of select="$c_support_light"/>; }
/* Clearing
*/
/* Self Clearing Goodness */
.container:after,
.row:after,
.u-cf {
content: "";
display: table;
clear: both; }
/* Media Queries
*/
/*
Note: The best way to structure the use of media queries is to create the queries
near the relevant code. For example, if you wanted to change the styles for buttons
on small devices, paste the mobile query code up in the buttons section and style it
there.
*/
/* Larger than mobile */
@media (min-width: 400px) {}
/* Larger than phablet (also point when grid becomes active) */
@media (min-width: 550px) {}
/* Larger than tablet */
@media (min-width: 750px) {}
/* Larger than desktop */
@media (min-width: 1000px) {}
/* Larger than Desktop HD */
@media (min-width: 1200px) {}
/* ROS specific */
.findingMetaBox {
background-color: <xsl:value-of select="$c_support_light"/>;
border-left: 1px solid <xsl:value-of select="$c_support_subtlydarkerlight"/>;
border-bottom: 1px solid <xsl:value-of select="$c_support_subtlydarkerlight"/>;
border-right: 1px solid <xsl:value-of select="$c_support_subtlydarkerlight"/>;
/* border-top is dynamically set according to finding severity */
padding: 3px 3px 3px 3px;
margin-bottom: 2rem;
}
.findingMetaBoxLabel {
font-weight: bold;
}
.status-new {
color: <xsl:value-of select="$color_new"/>;
}
.status-not_retested {
color: <xsl:value-of select="$color_notretested"/>;
}
.status-resolved {
color: <xsl:value-of select="$color_resolved"/>;
}
.errortext {
background-color: black;
color: <xsl:value-of select="$color_moderate"/>;
}
.censoredblock, .censoredtext {
background-color: black;
color: white;
font-weight: bold;
}
.finding-content {
margin-bottom: 2.5rem; }
.pieLegendText {
margin-left: 1rem;
}
h1, h2, h3, h4 {
margin-top: 2rem;
}
</xsl:template>
</xsl:stylesheet>

152
xml/xslt/fo_piecharts.xslt Normal file
View File

@@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" xmlns:my="http://www.radical.sexy"
exclude-result-prefixes="xs my"
version="2.0">
<xsl:import href="piecharts.xslt"/>
<xsl:template name="output_piechart_with_legend">
<xsl:param name="pieTable"/>
<xsl:param name="pieHeight"/>
<xsl:param name="pieTotal"/>
<xsl:param name="no_entries"/>
<xsl:param name="pieHeightHalf"/>
<xsl:param name="x"/>
<xsl:param name="pieAttr"/>
<xsl:for-each select="$pieTable">
<fo:block xsl:use-attribute-sets="p">
<fo:table margin-top="15px" xsl:use-attribute-sets="fwtable">
<!-- need some margin to make space for percentages that can't fit in the pie... -->
<fo:table-column column-width="{$pieHeight + 85}px"/>
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row keep-together.within-column="always">
<fo:table-cell xsl:use-attribute-sets="td indent_reset">
<fo:block>
<fo:instream-foreign-object
xmlns:svg="http://www.w3.org/2000/svg">
<!--set the display-->
<xsl:call-template name="pie_svg">
<xsl:with-param name="pieHeight" select="$pieHeight"/>
<xsl:with-param name="pieTotal" select="$pieTotal"/>
<xsl:with-param name="no_entries" select="$no_entries"/>
<xsl:with-param name="pieHeightHalf" select="$pieHeightHalf"/>
</xsl:call-template>
</fo:instream-foreign-object>
</fo:block>
</fo:table-cell>
<!-- PIE CHART LEGEND -->
<fo:table-cell>
<fo:block>
<fo:table xsl:use-attribute-sets="pieLegendTable fwtable">
<fo:table-column column-width="22px"/>
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body>
<xsl:for-each select="$pieTable/pieEntry">
<xsl:variable name="pieEntryLabelClean"
select="translate(pieEntryLabel, '/', '_')"/>
<xsl:variable name="pieEntryLabel">
<xsl:sequence
select="
string-join(for $x in tokenize(pieEntryLabel, '_')
return
my:titleCase($x), ' ')"
/>
</xsl:variable>
<fo:table-row>
<fo:table-cell
xsl:use-attribute-sets="pieLegendTableCell">
<fo:block>
<fo:instream-foreign-object>
<svg:svg height="13" width="13">
<svg:rect stroke="#706f6f" stroke-width="1"
stroke-linejoin="round" height="11" width="11">
<xsl:attribute name="fill">
<xsl:call-template name="selectColor">
<xsl:with-param name="position"
select="position()"/>
<xsl:with-param name="label"
select="pieEntryLabel"/>
</xsl:call-template>
</xsl:attribute>
</svg:rect>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:table-cell>
<fo:table-cell
xsl:use-attribute-sets="pieLegendTableCell">
<fo:block>
<xsl:value-of select="$pieEntryLabel"/>
<xsl:text> (</xsl:text>
<!-- for threatLevel legend, link to finding summary table -->
<xsl:choose>
<xsl:when test="$pieAttr = 'threatLevel'">
<fo:basic-link xsl:use-attribute-sets="link">
<xsl:attribute name="internal-destination"
>summaryTableThreatLevel<xsl:value-of
select="$pieEntryLabelClean"/></xsl:attribute>
<xsl:value-of select="pieEntryCount"/>
</fo:basic-link>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="pieEntryCount"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>)</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:for-each>
</xsl:template>
<xsl:template name="pie_percentage_large_slice_style">
<xsl:param name="text_angle"/>
<xsl:param name="middle_x"/>
<xsl:param name="text_line_x"/>
<xsl:param name="percentage"/>
<xsl:param name="part_half"/>
<xsl:param name="middle_y"/>
<xsl:param name="text_line_y"/>
<svg:text xsl:use-attribute-sets="PieFont">
<xsl:call-template name="pie_percentage_large_slice_content">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="middle_x" select="$middle_x"/>
<xsl:with-param name="text_line_x" select="$text_line_x"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
<xsl:with-param name="middle_y" select="$middle_y"/>
<xsl:with-param name="text_line_y" select="$text_line_y"/>
</xsl:call-template>
</svg:text>
</xsl:template>
<xsl:template name="pie_percentage_small_slice_style">
<xsl:param name="text_x_relative_to_line"/>
<xsl:param name="middle_y"/>
<xsl:param name="text_line_y"/>
<xsl:param name="percentage"/>
<svg:text text-anchor="end" xsl:use-attribute-sets="PieFont">
<xsl:call-template name="pie_percentage_small_slice_content">
<xsl:with-param name="text_x_relative_to_line" select="$text_x_relative_to_line"/>
<xsl:with-param name="middle_y" select="$middle_y"/>
<xsl:with-param name="text_line_y" select="$text_line_y"/>
<xsl:with-param name="percentage" select="$percentage"/>
</xsl:call-template>
</svg:text>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="xs"
version="2.0">
<xsl:import href="placeholders.xslt"/>
<xsl:template name="displayErrorText">
<xsl:param name="string" select="'XXXXXXXXXX'"/>
<fo:inline xsl:use-attribute-sets="errortext"><xsl:value-of select="$string"/></fo:inline>
</xsl:template>
<xsl:template name="generate_activities">
<fo:list-block xsl:use-attribute-sets="list">
<xsl:for-each select="/contract/meta/work/activities/activity">
<fo:list-item>
<!-- insert a bullet -->
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:inline>&#8226;</fo:inline>
</fo:block>
</fo:list-item-label>
<!-- list text -->
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:for-each>
</fo:list-block>
</xsl:template>
</xsl:stylesheet>

20
xml/xslt/fo_secrets.xslt Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="xs"
version="2.0">
<xsl:import href="secrets.xslt"/>
<xsl:template name="censoredBlock">
<fo:block xsl:use-attribute-sets="censoredblock">
<xsl:call-template name="checkIfLast"/>
<xsl:text>[ CENSORED ]</xsl:text>
</fo:block>
</xsl:template>
<xsl:template name="censoredInline">
<fo:inline xsl:use-attribute-sets="censoredtext">[ CENSORED ]</fo:inline>
</xsl:template>
</xsl:stylesheet>

View File

@@ -2,6 +2,16 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://www.radical.sexy"
exclude-result-prefixes="xs my" version="2.0">
<!-- color scheme, just change these to change colors throughout the suite -->
<xsl:variable name="c_main">#e2632a</xsl:variable>
<xsl:variable name="c_support_light">#ededed</xsl:variable>
<xsl:variable name="c_support_subtlydarkerlight">#e4e4e4</xsl:variable><!-- used for subtle light border around support_light background -->
<xsl:variable name="c_support_medium">#999999</xsl:variable><!-- used for subtle light border around support_light background -->
<xsl:variable name="c_support_dark">#444444</xsl:variable>
<xsl:variable name="c_main_contrast">white</xsl:variable>
<xsl:variable name="border-color">#444444</xsl:variable>
<!-- auto numbering format (used in various docs) -->
<xsl:param name="AUTO_NUMBERING_FORMAT" select="'1.1.1'"/>
@@ -65,6 +75,121 @@
<xsl:variable name="generic_piecolor_20">mediumturquoise</xsl:variable>
<xsl:variable name="generic_piecolor_21">navy</xsl:variable>
<xsl:variable name="generic_piecolor_other">black</xsl:variable>
<xsl:template name="selectColor">
<xsl:param name="label"/>
<xsl:param name="position"/>
<xsl:choose>
<!-- specific cases -->
<!-- threat level -->
<xsl:when test="$label = 'Extreme'">
<xsl:value-of select="$color_extreme"/>
</xsl:when>
<xsl:when test="$label = 'High'">
<xsl:value-of select="$color_high"/>
</xsl:when>
<xsl:when test="$label = 'Elevated'">
<xsl:value-of select="$color_elevated"/>
</xsl:when>
<xsl:when test="$label = 'Moderate'">
<xsl:value-of select="$color_moderate"/>
</xsl:when>
<xsl:when test="$label = 'Low'">
<xsl:value-of select="$color_low"/>
</xsl:when>
<xsl:when test="$label = 'N/A'">
<xsl:value-of select="$color_na"/>
</xsl:when>
<xsl:when test="$label = 'Unknown'">
<xsl:value-of select="$color_unknown"/>
</xsl:when>
<!-- status -->
<xsl:when test="$label = 'new'">
<xsl:value-of select="$color_new"/>
</xsl:when>
<xsl:when test="$label = 'unresolved'">
<xsl:value-of select="$color_unresolved"/>
</xsl:when>
<xsl:when test="$label = 'not_retested'">
<xsl:value-of select="$color_notretested"/>
</xsl:when>
<xsl:when test="$label = 'resolved'">
<xsl:value-of select="$color_resolved"/>
</xsl:when>
<xsl:otherwise>
<!-- generic pie chart -->
<xsl:choose>
<!-- Going with shades of green, yellow and blue/purple in all cases here so as not to imply severity levels -->
<xsl:when test="$position = 1">
<xsl:value-of select="$generic_piecolor_1"/>
</xsl:when>
<xsl:when test="$position = 2">
<xsl:value-of select="$generic_piecolor_2"/>
</xsl:when>
<xsl:when test="$position = 3">
<xsl:value-of select="$generic_piecolor_3"/>
</xsl:when>
<xsl:when test="$position = 4">
<xsl:value-of select="$generic_piecolor_4"/>
</xsl:when>
<xsl:when test="$position = 5">
<xsl:value-of select="$generic_piecolor_5"/>
</xsl:when>
<xsl:when test="$position = 6">
<xsl:value-of select="$generic_piecolor_6"/>
</xsl:when>
<xsl:when test="$position = 7">
<xsl:value-of select="$generic_piecolor_7"/>
</xsl:when>
<xsl:when test="$position = 8">
<xsl:value-of select="$generic_piecolor_8"/>
</xsl:when>
<xsl:when test="$position = 9">
<xsl:value-of select="$generic_piecolor_9"/>
</xsl:when>
<xsl:when test="$position = 10">
<xsl:value-of select="$generic_piecolor_10"/>
</xsl:when>
<xsl:when test="$position = 11">
<xsl:value-of select="$generic_piecolor_11"/>
</xsl:when>
<xsl:when test="$position = 12">
<xsl:value-of select="$generic_piecolor_12"/>
</xsl:when>
<xsl:when test="$position = 13">
<xsl:value-of select="$generic_piecolor_13"/>
</xsl:when>
<xsl:when test="$position = 14">
<xsl:value-of select="$generic_piecolor_14"/>
</xsl:when>
<xsl:when test="$position = 15">
<xsl:value-of select="$generic_piecolor_15"/>
</xsl:when>
<xsl:when test="$position = 16">
<xsl:value-of select="$generic_piecolor_16"/>
</xsl:when>
<xsl:when test="$position = 17">
<xsl:value-of select="$generic_piecolor_17"/>
</xsl:when>
<xsl:when test="$position = 18">
<xsl:value-of select="$generic_piecolor_18"/>
</xsl:when>
<xsl:when test="$position = 19">
<xsl:value-of select="$generic_piecolor_19"/>
</xsl:when>
<xsl:when test="$position = 20">
<xsl:value-of select="$generic_piecolor_20"/>
</xsl:when>
<xsl:when test="$position = 21">
<xsl:value-of select="$generic_piecolor_21"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$generic_piecolor_other"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- document version number (mostly for report) -->
<xsl:variable name="latestVersionNumber">
@@ -114,6 +239,88 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Finding stuff -->
<xsl:variable name="unsortedFindingSummaryTable">
<xsl:for-each-group select="//finding" group-by="@threatLevel">
<xsl:for-each select="current-group()">
<findingEntry>
<xsl:attribute name="Ref">
<xsl:value-of select="@Ref"/>
</xsl:attribute>
<xsl:attribute name="status">
<xsl:value-of select="@status"/>
</xsl:attribute>
<xsl:attribute name="findingId">
<xsl:value-of select="@id"/>
</xsl:attribute>
<findingNumber>
<xsl:apply-templates select="." mode="number"/>
</findingNumber>
<findingType>
<xsl:value-of select="@type"/>
</findingType>
<findingDescription>
<xsl:choose>
<xsl:when test="description_summary">
<xsl:value-of select="description_summary"/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="description" mode="summarytable"/>
</xsl:otherwise>
</xsl:choose>
</findingDescription>
<findingThreatLevel>
<xsl:value-of select="current-grouping-key()"/>
</findingThreatLevel>
</findingEntry>
</xsl:for-each>
</xsl:for-each-group>
</xsl:variable>
<xsl:variable name="findingSummaryTable">
<xsl:for-each select="$unsortedFindingSummaryTable/findingEntry">
<xsl:sort data-type="number" order="descending"
select="
(number(findingThreatLevel = 'Extreme') * 10)
+ (number(findingThreatLevel = 'High') * 9)
+ (number(findingThreatLevel = 'Elevated') * 8)
+ (number(findingThreatLevel = 'Moderate') * 7)
+ (number(findingThreatLevel = 'Low') * 6)
+ (number(findingThreatLevel = 'Unknown') * 3)
+ (number(findingThreatLevel = 'N/A') * 1)"/>
<xsl:variable name="findingThreatLevelClean"
select="translate(findingThreatLevel, '/', '_')"/>
<findingEntry>
<xsl:attribute name="Ref">
<xsl:value-of select="@Ref"/>
</xsl:attribute>
<xsl:attribute name="status">
<xsl:value-of select="@status"/>
</xsl:attribute>
<xsl:attribute name="findingId">
<xsl:value-of select="@findingId"/>
</xsl:attribute>
<!-- add an id for the first entry of each type so that we can link to it -->
<xsl:if
test="not(preceding-sibling::findingEntry/findingThreatLevel = findingThreatLevel)">
<xsl:attribute name="id">summaryTableThreatLevel<xsl:value-of
select="$findingThreatLevelClean"/></xsl:attribute>
</xsl:if>
<findingNumber>
<xsl:value-of select="findingNumber"/>
</findingNumber>
<findingType>
<xsl:value-of select="findingType"/>
</findingType>
<findingDescription>
<xsl:value-of select="findingDescription"/>
</findingDescription>
<findingThreatLevel>
<xsl:value-of select="findingThreatLevel"/>
</findingThreatLevel>
</findingEntry>
</xsl:for-each>
</xsl:variable>
<!-- Money stuff -->
<xsl:variable name="eur" select="'eur'"/>
@@ -195,4 +402,124 @@
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="my:calculatePeriod">
<xsl:param name="enddate"/>
<xsl:param name="startdate"/>
<xsl:variable name="startYear" as="xs:integer" select="year-from-date($startdate)"/>
<xsl:variable name="startMonth" as="xs:integer" select="month-from-date($startdate)"/>
<xsl:variable name="startDay" as="xs:integer" select="day-from-date($startdate)"/>
<xsl:variable name="endYear" as="xs:integer" select="year-from-date($enddate)"/>
<xsl:variable name="endMonth" as="xs:integer" select="month-from-date($enddate)"/>
<xsl:variable name="endDay" as="xs:integer" select="day-from-date($enddate)"/>
<xsl:variable name="startMonthNumberOfDays">
<xsl:choose>
<xsl:when test="xs:string($startMonth) = '1'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '2'">
<!-- I hate february -->
<xsl:choose>
<xsl:when test="$startYear mod 4 != 0">28</xsl:when>
<xsl:when test="$startYear mod 100 != 0">29</xsl:when>
<xsl:when test="$startYear mod 400 != 0">28</xsl:when>
<xsl:otherwise>29</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="xs:string($startMonth) = '3'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '4'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '5'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '6'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '7'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '8'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '9'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '10'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '11'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '12'">31</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numYears">
<xsl:choose>
<xsl:when test="$endMonth > $startMonth">
<xsl:sequence select="$endYear - $startYear"/>
</xsl:when>
<xsl:when test="$endMonth &lt; $startMonth">
<xsl:sequence select="$endYear - $startYear - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$endDay >= $startDay">
<xsl:sequence select="$endYear - $startYear"/>
</xsl:when>
<xsl:otherwise>
<!-- $endDay &lt; $startDay -->
<xsl:sequence select="$endYear - $startYear - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numMonths">
<xsl:choose>
<xsl:when test="$endDay &lt; $startDay">
<xsl:sequence select="$endMonth - $startMonth - 1"/>
</xsl:when>
<xsl:otherwise>
<!-- $endDay >= $startDay -->
<xsl:sequence select="$endMonth - $startMonth"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numDays">
<!--<xsl:choose>
<xsl:when test="$numMonths &lt; 1 and $numYears &lt; 1">
<!-\- only displaying days if contract is for less than a month -\->
<xsl:sequence select="($enddate - $startdate) div xs:dayTimeDuration('P1D')"/>
</xsl:when>
<xsl:otherwise>
<!-\- if contract is longer than a month, don't count days -\->
<xsl:sequence select="0"/>
</xsl:otherwise>
</xsl:choose>-->
<xsl:choose>
<xsl:when test="$endDay - $startDay &lt; 0">
<xsl:value-of select="$startMonthNumberOfDays - $startDay + $endDay"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$endDay - $startDay"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$numYears > 0">
<xsl:sequence select="$numYears"/>
<xsl:text>year</xsl:text>
<xsl:if test="$numYears > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when
test="($numMonths > 0 and $numDays = 0) or ($numMonths = 0 and $numDays > 0)">
<xsl:text> and</xsl:text>
</xsl:when>
<xsl:when test="$numMonths > 0 and $numDays > 0">
<xsl:text>,</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="$numMonths > 0">
<xsl:sequence select="$numMonths"/>
<xsl:text>month</xsl:text>
<xsl:if test="$numMonths > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:if test="$numDays > 0">
<xsl:text> and</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="$numDays > 0">
<xsl:sequence select="$numDays"/>
<xsl:text>day</xsl:text>
<xsl:if test="$numDays > 1">
<xsl:text>s</xsl:text>
</xsl:if>
</xsl:if>
</xsl:function>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,7 @@
<xsl:import href="generic.xslt"/>
<xsl:import href="numbering.xslt"/>
<xsl:import href="localisation.xslt"/>
<xsl:import href="placeholders.xslt"/>
<xsl:import href="fo_placeholders.xslt"/>
<xsl:import href="waiver.xslt"/>
<xsl:include href="functions_params_vars.xslt"/>
<xsl:include href="styles_off.xslt"/>

View File

@@ -8,7 +8,7 @@
<xsl:import href="block.xslt"/>
<xsl:import href="inline.xslt"/>
<xsl:import href="auto.xslt"/>
<xsl:import href="placeholders.xslt"/>
<xsl:import href="fo_placeholders.xslt"/>
<xsl:import href="structure.xslt"/>
<xsl:import href="lists.xslt"/>
<xsl:import href="generic.xslt"/>

View File

@@ -11,7 +11,7 @@
<xsl:import href="block.xslt"/>
<xsl:import href="findings.xslt"/>
<xsl:import href="auto.xslt"/>
<xsl:import href="piecharts.xslt"/>
<xsl:import href="fo_piecharts.xslt"/>
<xsl:import href="table.xslt"/>
<xsl:import href="lists.xslt"/>
<xsl:import href="inline.xslt"/>
@@ -19,8 +19,8 @@
<xsl:import href="generic.xslt"/>
<xsl:import href="numbering.xslt"/>
<xsl:import href="localisation.xslt"/>
<xsl:import href="placeholders.xslt"/>
<xsl:import href="secrets.xslt"/>
<xsl:import href="fo_placeholders.xslt"/>
<xsl:import href="fo_secrets.xslt"/>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:my="http://www.radical.sexy"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
<xsl:import href="piecharts.xslt"/>
<xsl:variable name="pieTextStyle">
<xsl:text>font-family: 'Open Sans'; font-size: 11pt; color:
black;</xsl:text>
</xsl:variable>
<xsl:template name="output_piechart_with_legend">
<xsl:param name="pieTable"/>
<xsl:param name="pieHeight"/>
<xsl:param name="pieTotal"/>
<xsl:param name="no_entries"/>
<xsl:param name="pieHeightHalf"/>
<xsl:param name="x"/>
<xsl:param name="pieAttr"/>
<xsl:for-each select="$pieTable">
<div class="row">
<div class="five columns">
<xsl:call-template name="pie_svg">
<xsl:with-param name="pieHeight" select="$pieHeight"/>
<xsl:with-param name="pieTotal" select="$pieTotal"/>
<xsl:with-param name="no_entries" select="$no_entries"/>
<xsl:with-param name="pieHeightHalf" select="$pieHeightHalf"/>
</xsl:call-template>
</div>
<!-- PIE CHART LEGEND -->
<div class="seven columns">
<xsl:for-each select="$pieTable/pieEntry">
<xsl:variable name="pieEntryLabelClean"
select="translate(pieEntryLabel, '/', '_')"/>
<xsl:variable name="pieEntryLabel">
<xsl:sequence
select="
string-join(for $x in tokenize(pieEntryLabel, '_')
return
my:titleCase($x), ' ')"
/>
</xsl:variable>
<div>
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16">
<rect xmlns="http://www.w3.org/2000/svg" stroke="#706f6f"
stroke-width="1" stroke-linejoin="round" height="16" width="16">
<xsl:attribute name="fill">
<xsl:call-template name="selectColor">
<xsl:with-param name="position" select="position()"/>
<xsl:with-param name="label" select="pieEntryLabel"/>
</xsl:call-template>
</xsl:attribute>
</rect>
</svg>
<span class="pieLegendText">
<xsl:value-of select="$pieEntryLabel"/>
<xsl:text> (</xsl:text>
<!-- for threatLevel legend, link to finding summary table -->
<xsl:choose>
<xsl:when test="$pieAttr = 'threatLevel'">
<a>
<xsl:attribute name="href"
>#summaryTableThreatLevel<xsl:value-of
select="$pieEntryLabelClean"/></xsl:attribute>
<xsl:value-of select="pieEntryCount"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="pieEntryCount"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>)</xsl:text>
</span>
</div>
</xsl:for-each>
</div>
</div>
</xsl:for-each>
</xsl:template>
<xsl:template name="pie_percentage_large_slice_style">
<xsl:param name="text_angle"/>
<xsl:param name="middle_x"/>
<xsl:param name="text_line_x"/>
<xsl:param name="percentage"/>
<xsl:param name="part_half"/>
<xsl:param name="middle_y"/>
<xsl:param name="text_line_y"/>
<text xmlns="http://www.w3.org/2000/svg">
<xsl:attribute name="style"><xsl:value-of select="normalize-space($pieTextStyle)"/></xsl:attribute>
<xsl:call-template name="pie_percentage_large_slice_content">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="middle_x" select="$middle_x"/>
<xsl:with-param name="text_line_x" select="$text_line_x"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
<xsl:with-param name="middle_y" select="$middle_y"/>
<xsl:with-param name="text_line_y" select="$text_line_y"/>
</xsl:call-template>
</text>
</xsl:template>
<xsl:template name="pie_percentage_small_slice_style">
<xsl:param name="text_x_relative_to_line"/>
<xsl:param name="middle_y"/>
<xsl:param name="text_line_y"/>
<xsl:param name="percentage"/>
<text xmlns="http://www.w3.org/2000/svg" text-anchor="end">
<xsl:attribute name="style"><xsl:value-of select="normalize-space($pieTextStyle)"/></xsl:attribute>
<xsl:call-template name="pie_percentage_small_slice_content">
<xsl:with-param name="text_x_relative_to_line" select="$text_x_relative_to_line"/>
<xsl:with-param name="middle_y" select="$middle_y"/>
<xsl:with-param name="text_line_y" select="$text_line_y"/>
<xsl:with-param name="percentage" select="$percentage"/>
</xsl:call-template>
</text>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:import href="placeholders.xslt"/>
<xsl:template name="displayErrorText">
<xsl:param name="string" select="'XXXXXXXXXX'"/>
<span class="errortext"><xsl:value-of select="$string"/></span>
</xsl:template>
<xsl:template name="generate_activities"/>
</xsl:stylesheet>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:import href="secrets.xslt"/>
<xsl:template name="censoredInline">
<span class="censoredtext">[ CENSORED ]</span>
</xsl:template>
<xsl:template name="censoredBlock">
<div class="censoredblock">
<xsl:text>[ CENSORED ]</xsl:text>
</div>
</xsl:template>
</xsl:stylesheet>

View File

@@ -6,9 +6,6 @@
<xsl:variable name="strdoc"
select="document('../source/snippets/localisationstrings.xml')/localised_strings"/>
<xsl:template name="getString">
<xsl:param name="stringID" select="'none'"/>

View File

@@ -3,6 +3,10 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:my="http://www.radical.sexy" exclude-result-prefixes="xs math" version="2.0">
<!-- Note: any svg here should be output as <svg xmlns:svg="http://www.w3.org/2000/svg"> rather than <svg:svg> to make the result readable both by xsl-fo parsers and html5 parsers (fop and browsers, specifically ;) -->
<xsl:template match="generate_piechart">
<xsl:choose>
<xsl:when test="//finding">
@@ -21,8 +25,10 @@
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<fo:block xsl:use-attribute-sets="errortext">Pie chart can only be generated when
there are findings in the report. Get to work! ;)</fo:block>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">Pie chart can only be generated when
there are findings in the report. Get to work! ;)</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -184,127 +190,51 @@
</xsl:if>
</xsl:variable>
<xsl:variable name="no_entries" select="count($pieTable/pieEntry)"/>
<xsl:for-each select="$pieTable">
<fo:block xsl:use-attribute-sets="p">
<fo:table margin-top="15px" xsl:use-attribute-sets="fwtable">
<!-- need some margin to make space for percentages that can't fit in the pie... -->
<fo:table-column column-width="{$pieHeight + 85}px"/>
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body>
<fo:table-row keep-together.within-column="always">
<fo:table-cell xsl:use-attribute-sets="td indent_reset">
<fo:block>
<fo:instream-foreign-object
xmlns:svg="http://www.w3.org/2000/svg">
<!--set the display-->
<svg:svg>
<!-- width and height of the viewport -->
<xsl:attribute name="width">
<xsl:value-of select="$pieHeight + 30"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="$pieHeight + 30"/>
</xsl:attribute>
<!-- viewBox to scale -->
<xsl:attribute name="viewBox">
<!-- start viewbox 15px to the left and make it 15px larger to catch svg's cutoff text -->
<xsl:value-of
select="concat('-15 0 ', $pieHeight + 15 + 30, ' ', $pieHeight + 30)"
/>
</xsl:attribute>
<!--call the template starting at the last slice-->
<xsl:call-template name="pie_chart_slice">
<xsl:with-param name="pieTotal" select="$pieTotal"/>
<xsl:with-param name="no_entries"
select="$no_entries"/>
<xsl:with-param name="position" select="$no_entries"/>
<xsl:with-param name="middle_x"
select="$pieHeightHalf"/>
<xsl:with-param name="middle_y"
select="$pieHeightHalf"/>
<xsl:with-param name="move_x" select="0"/>
<xsl:with-param name="radius"
select="$pieHeightHalf div 100 * 85"/>
</xsl:call-template>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:table-cell>
<!-- PIE CHART LEGEND -->
<fo:table-cell>
<fo:block>
<fo:table xsl:use-attribute-sets="pieLegendTable fwtable">
<fo:table-column column-width="22px"/>
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-body>
<xsl:for-each select="$pieTable/pieEntry">
<xsl:variable name="pieEntryLabelClean"
select="translate(pieEntryLabel, '/', '_')"/>
<xsl:variable name="pieEntryLabel">
<xsl:sequence
select="
string-join(for $x in tokenize(pieEntryLabel, '_')
return
my:titleCase($x), ' ')"
/>
</xsl:variable>
<fo:table-row>
<fo:table-cell
xsl:use-attribute-sets="pieLegendTableCell">
<fo:block>
<fo:instream-foreign-object>
<svg:svg height="13" width="13">
<svg:rect stroke="#706f6f" stroke-width="1"
stroke-linejoin="round" height="11" width="11">
<xsl:attribute name="fill">
<xsl:call-template name="selectColor">
<xsl:with-param name="position"
select="position()"/>
<xsl:with-param name="label"
select="pieEntryLabel"/>
</xsl:call-template>
</xsl:attribute>
</svg:rect>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
</fo:table-cell>
<fo:table-cell
xsl:use-attribute-sets="pieLegendTableCell">
<fo:block>
<xsl:value-of select="$pieEntryLabel"/>
<xsl:text> (</xsl:text>
<!-- for threatLevel legend, link to finding summary table -->
<xsl:choose>
<xsl:when test="$pieAttr = 'threatLevel'">
<fo:basic-link xsl:use-attribute-sets="link">
<xsl:attribute name="internal-destination"
>summaryTableThreatLevel<xsl:value-of
select="$pieEntryLabelClean"/></xsl:attribute>
<xsl:value-of select="pieEntryCount"/>
</fo:basic-link>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="pieEntryCount"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>)</xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:for-each>
<xsl:call-template name="output_piechart_with_legend">
<xsl:with-param name="pieTable" select="$pieTable"/>
<xsl:with-param name="pieHeight" select="$pieHeight"/>
<xsl:with-param name="pieTotal" select="$pieTotal"/>
<xsl:with-param name="no_entries" select="$no_entries"/>
<xsl:with-param name="pieHeightHalf" select="$pieHeightHalf"/>
<xsl:with-param name="pieAttr" select="$pieAttr"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="pie_svg">
<xsl:param name="pieHeight"/>
<xsl:param name="pieTotal"/>
<xsl:param name="no_entries"/>
<xsl:param name="pieHeightHalf"/>
<xsl:variable name="spacing_for_percentage_labels">40</xsl:variable>
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300" viewBox="-40 0 300 300">
<!-- The bit below tried to configure the piechart size but basically nobody ever changes it and it just makes it all way too difficult -->
<!-- width and height of the viewport -->
<!--<xsl:attribute name="width">
<xsl:value-of select="$pieHeight + $spacing_for_percentage_labels * 2"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="$pieHeight + $spacing_for_percentage_labels * 2"/>
</xsl:attribute>
<!-\- viewBox to scale -\->
<xsl:attribute name="viewBox">
<!-\- start viewbox 15px to the left and make it 15px larger to catch svg's cutoff text -\->
<xsl:value-of select="concat(-$spacing_for_percentage_labels, ' 0 ', $pieHeight + $spacing_for_percentage_labels * 2, ' ', $pieHeight + ($spacing_for_percentage_labels * 3))"
/>
</xsl:attribute>-->
<!--call the template starting at the last slice-->
<xsl:call-template name="pie_chart_slice">
<xsl:with-param name="pieTotal" select="$pieTotal"/>
<xsl:with-param name="no_entries" select="$no_entries"/>
<xsl:with-param name="position" select="$no_entries"/>
<xsl:with-param name="middle_x" select="$pieHeightHalf"/>
<xsl:with-param name="middle_y" select="$pieHeightHalf"/>
<xsl:with-param name="move_x" select="0"/>
<xsl:with-param name="radius" select="$pieHeightHalf div 100 * 85"/>
</xsl:call-template>
</svg>
</xsl:template>
<xsl:template name="pie_chart_slice">
<xsl:param name="pieTotal"/>
@@ -337,7 +267,7 @@
<xsl:variable name="d"
select="concat($middle, ' ', $first_line, ' ', 'a ', $radius, ',', $radius, ' ', $arc_move, ' ', $x, ',', $radius - $y, ' ', 'z')"/>
<!--put it all together-->
<svg:path stroke="white" stroke-width="1" stroke-linejoin="round">
<path xmlns="http://www.w3.org/2000/svg" stroke="white" stroke-width="1" stroke-linejoin="round">
<xsl:attribute name="fill">
<xsl:call-template name="selectColor">
<xsl:with-param name="position" select="$position"/>
@@ -348,7 +278,7 @@
<xsl:attribute name="d">
<xsl:value-of select="$d"/>
</xsl:attribute>
</svg:path>
</path>
<!--now the percentage-->
<xsl:variable name="percentage" as="xs:double"
select="(//pieEntry[position() = $position]/pieEntryCount div sum(//pieEntry/pieEntryCount)) * 100"/>
@@ -367,231 +297,15 @@
<xsl:choose>
<xsl:when test="$percentage >= 3.5">
<!--on the edge-->
<svg:text xsl:use-attribute-sets="PieFont">
<xsl:attribute name="x">
<xsl:choose>
<!-- try for some better placement of percentages than the standard -->
<xsl:when test="$text_angle &lt;= 22.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 45 and $text_angle &gt; 22.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 67.5 and $text_angle &gt; 45">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 85 and $text_angle &gt; 67.5">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 95 and $text_angle &gt; 85">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 112.5 and $text_angle &gt; 95">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 135 and $text_angle &gt; 112.5">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 157.5 and $text_angle &gt; 135">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 180 and $text_angle &gt; 157.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 202.5 and $text_angle &gt; 180">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 225 and $text_angle &gt; 202.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 247.5 and $text_angle &gt; 225">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 265 and $text_angle &gt; 247.5">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 275 and $text_angle &gt; 265">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 292.5 and $text_angle &gt; 275">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 315 and $text_angle &gt; 292.5">
<xsl:value-of select="$middle_x + $text_line_x + 6"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 337.5 and $text_angle &gt; 315">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 360 and $text_angle &gt; 337.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$middle_x + $text_line_x"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:choose>
<!-- when in top right/bottom left quarters of circle, bring percentage text a bit closer to the circle -->
<xsl:when test="$text_angle &lt;= 22.5">
<xsl:value-of select="$middle_y - $text_line_y + 5"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 45 and $text_angle &gt; 22.5">
<xsl:value-of select="$middle_y - $text_line_y + 4"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 67.5 and $text_angle &gt; 45">
<xsl:value-of select="$middle_y - $text_line_y + 3"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 90 and $text_angle &gt; 67.5">
<xsl:value-of select="$middle_y - $text_line_y + 2"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 112.5 and $text_angle &gt; 90">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 135 and $text_angle &gt; 112.5">
<xsl:value-of select="$middle_y - $text_line_y - 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 157.5 and $text_angle &gt; 135">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 180 and $text_angle &gt; 157.5">
<xsl:value-of select="$middle_y - $text_line_y - 0"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 202.5 and $text_angle &gt; 180">
<xsl:value-of select="$middle_y - $text_line_y - 0"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 225 and $text_angle &gt; 202.5">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 247.5 and $text_angle &gt; 225">
<xsl:value-of select="$middle_y - $text_line_y - 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 270 and $text_angle &gt; 247.5">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 292.5 and $text_angle &gt; 270">
<xsl:value-of select="$middle_y - $text_line_y + 2"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 315 and $text_angle &gt; 292.5">
<xsl:value-of select="$middle_y - $text_line_y + 3"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 337.5 and $text_angle &gt; 315">
<xsl:value-of select="$middle_y - $text_line_y + 4"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 360 and $text_angle &gt; 337.5">
<xsl:value-of select="$middle_y - $text_line_y + 5"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$middle_y - $text_line_y"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="text-anchor">
<xsl:choose>
<!-- when in top/bottom quarters of circle, text is anchored in the middle, when left on end, when right on start -->
<xsl:when
test="($text_angle &gt;= 315 or $text_angle &lt;= 45) or ($text_angle &lt;= 225 and $text_angle &gt;= 135)"
>middle</xsl:when>
<xsl:when test="$text_angle &lt; 135 and $text_angle &gt; 45"
>start</xsl:when>
<xsl:when test="$text_angle &lt; 315 and $text_angle &gt; 225"
>end</xsl:when>
<xsl:otherwise>middle</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="format-number($percentage, '##,##0.0')"/>
<xsl:text>%</xsl:text>
</svg:text>
<xsl:call-template name="pie_percentage_large_slice_style">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="middle_x" select="$middle_x"/>
<xsl:with-param name="text_line_x" select="$text_line_x"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
<xsl:with-param name="middle_y" select="$middle_y"/>
<xsl:with-param name="text_line_y" select="$text_line_y"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!--extra line pointing into the slice-->
@@ -613,37 +327,22 @@
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<svg:path stroke="black" stroke-width="1" stroke-linejoin="round">
<path xmlns="http://www.w3.org/2000/svg" stroke="black" stroke-width="1" stroke-linejoin="round">
<xsl:attribute name="fill">none</xsl:attribute>
<xsl:attribute name="d">
<xsl:value-of
select="concat('M', ' ', $middle_x + $text_x, ',', $middle_y - $text_y, ' ', 'L', ' ', $middle_x + $text_line_x, ',', $middle_y - $text_line_y, ' ', 'H', ' ', $middle_x + $text_line_x + $line_dir)"
/>
</xsl:attribute>
</svg:path>
<svg:text text-anchor="end" xsl:use-attribute-sets="PieFont">
<xsl:attribute name="x">
<!-- placement of text depends on where extra line is pointing -->
<xsl:value-of select="$text_x_relative_to_line"/>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:attribute>
<xsl:value-of select="format-number($percentage, '##,##0.0')"/>
<xsl:text>%</xsl:text>
</svg:text>
</path>
<xsl:call-template name="pie_percentage_small_slice_style">
<xsl:with-param name="text_x_relative_to_line" select="$text_x_relative_to_line"/>
<xsl:with-param name="middle_y" select="$middle_y"/>
<xsl:with-param name="text_line_y" select="$text_line_y"/>
<xsl:with-param name="percentage" select="$percentage"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
<!--<svg:text text-anchor="middle" xsl:use-attribute-sets="DefaultFont">
<xsl:attribute name="x">
<xsl:value-of select="$middle_x + $text_line_x"/>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:value-of select="$middle_y - $text_line_y"/>
</xsl:attribute>
<xsl:value-of select="format-number($percentage, '##,##0.0')"/>
<xsl:text>%</xsl:text>
</svg:text>-->
<!--loop until we reach the first part-->
<xsl:if test="$position > 1">
<xsl:call-template name="pie_chart_slice">
@@ -657,6 +356,253 @@
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="pie_percentage_small_slice_content">
<xsl:param name="text_x_relative_to_line"/>
<xsl:param name="middle_y"/>
<xsl:param name="text_line_y"/>
<xsl:param name="percentage"/>
<xsl:attribute name="x">
<!-- placement of text depends on where extra line is pointing -->
<xsl:value-of select="$text_x_relative_to_line"/>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:attribute>
<xsl:value-of select="format-number($percentage, '##,##0.0')"/>
<xsl:text>%</xsl:text>
</xsl:template>
<xsl:template name="pie_percentage_large_slice_content">
<xsl:param name="text_angle"/>
<xsl:param name="middle_x"/>
<xsl:param name="text_line_x"/>
<xsl:param name="percentage"/>
<xsl:param name="part_half"/>
<xsl:param name="middle_y"/>
<xsl:param name="text_line_y"/>
<xsl:attribute name="x">
<xsl:choose>
<!-- try for some better placement of percentages than the standard -->
<xsl:when test="$text_angle &lt;= 22.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 45 and $text_angle &gt; 22.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 67.5 and $text_angle &gt; 45">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 85 and $text_angle &gt; 67.5">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 95 and $text_angle &gt; 85">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 112.5 and $text_angle &gt; 95">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 135 and $text_angle &gt; 112.5">
<xsl:value-of select="$middle_x + $text_line_x - 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 157.5 and $text_angle &gt; 135">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 180 and $text_angle &gt; 157.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 202.5 and $text_angle &gt; 180">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 225 and $text_angle &gt; 202.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 247.5 and $text_angle &gt; 225">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 265 and $text_angle &gt; 247.5">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 275 and $text_angle &gt; 265">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 292.5 and $text_angle &gt; 275">
<xsl:value-of select="$middle_x + $text_line_x + 8"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 315 and $text_angle &gt; 292.5">
<xsl:value-of select="$middle_x + $text_line_x + 6"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 337.5 and $text_angle &gt; 315">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="$text_angle &lt;= 360 and $text_angle &gt; 337.5">
<xsl:value-of select="$middle_x + $text_line_x"/>
<xsl:call-template name="piechartdebug">
<xsl:with-param name="text_angle" select="$text_angle"/>
<xsl:with-param name="percentage" select="$percentage"/>
<xsl:with-param name="part_half" select="$part_half"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$middle_x + $text_line_x"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="y">
<xsl:choose>
<!-- when in top right/bottom left quarters of circle, bring percentage text a bit closer to the circle -->
<xsl:when test="$text_angle &lt;= 22.5">
<xsl:value-of select="$middle_y - $text_line_y + 5"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 45 and $text_angle &gt; 22.5">
<xsl:value-of select="$middle_y - $text_line_y + 4"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 67.5 and $text_angle &gt; 45">
<xsl:value-of select="$middle_y - $text_line_y + 3"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 90 and $text_angle &gt; 67.5">
<xsl:value-of select="$middle_y - $text_line_y + 2"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 112.5 and $text_angle &gt; 90">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 135 and $text_angle &gt; 112.5">
<xsl:value-of select="$middle_y - $text_line_y - 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 157.5 and $text_angle &gt; 135">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 180 and $text_angle &gt; 157.5">
<xsl:value-of select="$middle_y - $text_line_y - 0"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 202.5 and $text_angle &gt; 180">
<xsl:value-of select="$middle_y - $text_line_y - 0"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 225 and $text_angle &gt; 202.5">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 247.5 and $text_angle &gt; 225">
<xsl:value-of select="$middle_y - $text_line_y - 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 270 and $text_angle &gt; 247.5">
<xsl:value-of select="$middle_y - $text_line_y + 1"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 292.5 and $text_angle &gt; 270">
<xsl:value-of select="$middle_y - $text_line_y + 2"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 315 and $text_angle &gt; 292.5">
<xsl:value-of select="$middle_y - $text_line_y + 3"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 337.5 and $text_angle &gt; 315">
<xsl:value-of select="$middle_y - $text_line_y + 4"/>
</xsl:when>
<xsl:when test="$text_angle &lt;= 360 and $text_angle &gt; 337.5">
<xsl:value-of select="$middle_y - $text_line_y + 5"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$middle_y - $text_line_y"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="text-anchor">
<xsl:choose>
<!-- when in top/bottom quarters of circle, text is anchored in the middle, when left on end, when right on start -->
<xsl:when
test="($text_angle &gt;= 315 or $text_angle &lt;= 45) or ($text_angle &lt;= 225 and $text_angle &gt;= 135)"
>middle</xsl:when>
<xsl:when test="$text_angle &lt; 135 and $text_angle &gt; 45">start</xsl:when>
<xsl:when test="$text_angle &lt; 315 and $text_angle &gt; 225">end</xsl:when>
<xsl:otherwise>middle</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="format-number($percentage, '##,##0.0')"/>
<xsl:text>%</xsl:text>
</xsl:template>
<xsl:template name="piechartdebug">
<xsl:param name="text_angle"/>
@@ -666,118 +612,5 @@
<xsl:message>TEXT ANGLE: <xsl:value-of select="$text_angle"/></xsl:message>-->
</xsl:template>
<xsl:template name="selectColor">
<xsl:param name="label"/>
<xsl:param name="position"/>
<xsl:choose>
<!-- specific cases -->
<!-- threat level -->
<xsl:when test="$label = 'Extreme'">
<xsl:value-of select="$color_extreme"/>
</xsl:when>
<xsl:when test="$label = 'High'">
<xsl:value-of select="$color_high"/>
</xsl:when>
<xsl:when test="$label = 'Elevated'">
<xsl:value-of select="$color_elevated"/>
</xsl:when>
<xsl:when test="$label = 'Moderate'">
<xsl:value-of select="$color_moderate"/>
</xsl:when>
<xsl:when test="$label = 'Low'">
<xsl:value-of select="$color_low"/>
</xsl:when>
<xsl:when test="$label = 'N/A'">
<xsl:value-of select="$color_na"/>
</xsl:when>
<xsl:when test="$label = 'Unknown'">
<xsl:value-of select="$color_unknown"/>
</xsl:when>
<!-- status -->
<xsl:when test="$label = 'new'">
<xsl:value-of select="$color_new"/>
</xsl:when>
<xsl:when test="$label = 'unresolved'">
<xsl:value-of select="$color_unresolved"/>
</xsl:when>
<xsl:when test="$label = 'not_retested'">
<xsl:value-of select="$color_notretested"/>
</xsl:when>
<xsl:when test="$label = 'resolved'">
<xsl:value-of select="$color_resolved"/>
</xsl:when>
<xsl:otherwise>
<!-- generic pie chart -->
<xsl:choose>
<!-- Going with shades of green, yellow and blue/purple in all cases here so as not to imply severity levels -->
<xsl:when test="$position = 1">
<xsl:value-of select="$generic_piecolor_1"/>
</xsl:when>
<xsl:when test="$position = 2">
<xsl:value-of select="$generic_piecolor_2"/>
</xsl:when>
<xsl:when test="$position = 3">
<xsl:value-of select="$generic_piecolor_3"/>
</xsl:when>
<xsl:when test="$position = 4">
<xsl:value-of select="$generic_piecolor_4"/>
</xsl:when>
<xsl:when test="$position = 5">
<xsl:value-of select="$generic_piecolor_5"/>
</xsl:when>
<xsl:when test="$position = 6">
<xsl:value-of select="$generic_piecolor_6"/>
</xsl:when>
<xsl:when test="$position = 7">
<xsl:value-of select="$generic_piecolor_7"/>
</xsl:when>
<xsl:when test="$position = 8">
<xsl:value-of select="$generic_piecolor_8"/>
</xsl:when>
<xsl:when test="$position = 9">
<xsl:value-of select="$generic_piecolor_9"/>
</xsl:when>
<xsl:when test="$position = 10">
<xsl:value-of select="$generic_piecolor_10"/>
</xsl:when>
<xsl:when test="$position = 11">
<xsl:value-of select="$generic_piecolor_11"/>
</xsl:when>
<xsl:when test="$position = 12">
<xsl:value-of select="$generic_piecolor_12"/>
</xsl:when>
<xsl:when test="$position = 13">
<xsl:value-of select="$generic_piecolor_13"/>
</xsl:when>
<xsl:when test="$position = 14">
<xsl:value-of select="$generic_piecolor_14"/>
</xsl:when>
<xsl:when test="$position = 15">
<xsl:value-of select="$generic_piecolor_15"/>
</xsl:when>
<xsl:when test="$position = 16">
<xsl:value-of select="$generic_piecolor_16"/>
</xsl:when>
<xsl:when test="$position = 17">
<xsl:value-of select="$generic_piecolor_17"/>
</xsl:when>
<xsl:when test="$position = 18">
<xsl:value-of select="$generic_piecolor_18"/>
</xsl:when>
<xsl:when test="$position = 19">
<xsl:value-of select="$generic_piecolor_19"/>
</xsl:when>
<xsl:when test="$position = 20">
<xsl:value-of select="$generic_piecolor_20"/>
</xsl:when>
<xsl:when test="$position = 21">
<xsl:value-of select="$generic_piecolor_21"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$generic_piecolor_other"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -1,24 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:my="http://radical.sexy" exclude-result-prefixes="xs my" version="2.0">
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my="http://www.radical.sexy"
exclude-result-prefixes="xs my" version="2.0">
<xsl:template name="getDenomination">
<xsl:param name="placeholderElement" as="node()" select="/"/>
<xsl:choose>
<xsl:when test="$placeholderElement/ancestor-or-self::*/@denomination = 'eur'"
<xsl:when
test="$placeholderElement/ancestor-or-self::*[@denomination][1]/@denomination = 'eur'"
></xsl:when>
<xsl:when test="$placeholderElement/ancestor-or-self::*/@denomination = 'usd'"
<xsl:when
test="$placeholderElement/ancestor-or-self::*[@denomination][1]/@denomination = 'usd'"
>$</xsl:when>
<xsl:when test="$placeholderElement/ancestor-or-self::*/@denomination = 'gbp'"
<xsl:when
test="$placeholderElement/ancestor-or-self::*[@denomination][1]/@denomination = 'gbp'"
>£</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="errortext">WARNING: NO DENOMINATION
FOUND</fo:inline>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">WARNING: NO DENOMINATION FOUND</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- PLACEHOLDERS -->
<xsl:template match="client_long">
<xsl:param name="placeholderElement" select="/*/meta//client/full_name"/>
@@ -274,10 +279,12 @@
<xsl:template match="contract_activities">
<xsl:choose>
<xsl:when test="/contract/meta/work/activities/activity">
<xsl:call-template name="generate_activities_xslt"/>
<xsl:call-template name="generate_activities"/>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="errortext">XXXXXX</fo:inline>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">WARNING: NO ACTIVITIES FOUND</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -442,7 +449,7 @@
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(//finding[@threatLevel = $threatLevel])"/>
$threatLevel])"/> </xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
@@ -454,11 +461,15 @@
<xsl:template match="todo">
<xsl:choose>
<xsl:when test="@desc">
<fo:inline xsl:use-attribute-sets="errortext">### TODO: <xsl:value-of select="@desc"
/> ###</fo:inline>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">### TODO: <xsl:value-of select="@desc"/>
###</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="errortext">### TODO ###</fo:inline>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">### TODO ###</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -493,13 +504,12 @@
</xsl:when>
<xsl:when
test="(self::contract_end_date or self::contract_start_date or self::generate_raterevisiondate or self::p_startdate or self::p_enddate) and normalize-space(.) = 'TBD'">
<!-- actual TBD, don't mess with it -->
<fo:text>TBD</fo:text>
</xsl:when>
<!-- actual TBD, don't mess with it --> TBD </xsl:when>
<xsl:when
test="(self::contract_end_date or self::contract_start_date or self::generate_raterevisiondate or self::p_startdate or self::p_enddate) and not(string($placeholderElement) castable as xs:date)">
<!-- pretty printing for date -->
<fo:inline xsl:use-attribute-sets="errortext">TBD</fo:inline>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">TBD</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:when
test="self::contract_period_unit and /contract/meta/scope/contract_type = 'single_engagement'">
@@ -583,13 +593,13 @@
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="errortext">[ <fo:inline
xsl:use-attribute-sets="bold">WARNING</fo:inline>: Cannot resolve
placeholder <fo:inline xsl:use-attribute-sets="bold"><xsl:value-of
select="name()"/></fo:inline> in <xsl:value-of select="base-uri()"/> -
<xsl:call-template name="getReason"><xsl:with-param
name="placeholderElement" select="$placeholderElement"
/></xsl:call-template> ]</fo:inline>
<xsl:call-template name="displayErrorText">
<xsl:with-param name="string">[ WARNING: Cannot resolve placeholder
<xsl:value-of select="name()"/> in <xsl:value-of select="base-uri()"/> -
<xsl:call-template name="getReason"><xsl:with-param
name="placeholderElement" select="$placeholderElement"
/></xsl:call-template> ]</xsl:with-param>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -597,10 +607,10 @@
<xsl:template name="getReason">
<xsl:param name="placeholderElement" select="."/>
<xsl:choose>
<xsl:when test="/$placeholderElement"> element <fo:inline xsl:use-attribute-sets="bold"
>"<xsl:value-of select="name($placeholderElement)"/>"</fo:inline>
(<xsl:call-template name="getXPath"><xsl:with-param name="element"
select="$placeholderElement"/></xsl:call-template>) is empty </xsl:when>
<xsl:when test="/$placeholderElement"> element "<xsl:value-of
select="name($placeholderElement)"/>" (<xsl:call-template name="getXPath"
><xsl:with-param name="element" select="$placeholderElement"
/></xsl:call-template>) is empty </xsl:when>
<xsl:otherwise> referenced element not found </xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -619,144 +629,6 @@
</xsl:for-each>
</xsl:template>
<xsl:template name="generate_activities_xslt">
<fo:list-block xsl:use-attribute-sets="list">
<xsl:for-each select="/contract/meta/work/activities/activity">
<fo:list-item>
<!-- insert a bullet -->
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:inline>&#8226;</fo:inline>
</fo:block>
</fo:list-item-label>
<!-- list text -->
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</xsl:for-each>
</fo:list-block>
</xsl:template>
<xsl:function name="my:calculatePeriod">
<xsl:param name="enddate"/>
<xsl:param name="startdate"/>
<xsl:variable name="startYear" as="xs:integer" select="year-from-date($startdate)"/>
<xsl:variable name="startMonth" as="xs:integer" select="month-from-date($startdate)"/>
<xsl:variable name="startDay" as="xs:integer" select="day-from-date($startdate)"/>
<xsl:variable name="endYear" as="xs:integer" select="year-from-date($enddate)"/>
<xsl:variable name="endMonth" as="xs:integer" select="month-from-date($enddate)"/>
<xsl:variable name="endDay" as="xs:integer" select="day-from-date($enddate)"/>
<xsl:variable name="startMonthNumberOfDays">
<xsl:choose>
<xsl:when test="xs:string($startMonth) = '1'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '2'">
<!-- I hate february -->
<xsl:choose>
<xsl:when test="$startYear mod 4 != 0">28</xsl:when>
<xsl:when test="$startYear mod 100 != 0">29</xsl:when>
<xsl:when test="$startYear mod 400 != 0">28</xsl:when>
<xsl:otherwise>29</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="xs:string($startMonth) = '3'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '4'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '5'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '6'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '7'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '8'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '9'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '10'">31</xsl:when>
<xsl:when test="xs:string($startMonth) = '11'">30</xsl:when>
<xsl:when test="xs:string($startMonth) = '12'">31</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numYears">
<xsl:choose>
<xsl:when test="$endMonth > $startMonth">
<xsl:sequence select="$endYear - $startYear"/>
</xsl:when>
<xsl:when test="$endMonth &lt; $startMonth">
<xsl:sequence select="$endYear - $startYear - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$endDay >= $startDay">
<xsl:sequence select="$endYear - $startYear"/>
</xsl:when>
<xsl:otherwise>
<!-- $endDay &lt; $startDay -->
<xsl:sequence select="$endYear - $startYear - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numMonths">
<xsl:choose>
<xsl:when test="$endDay &lt; $startDay">
<xsl:sequence select="$endMonth - $startMonth - 1"/>
</xsl:when>
<xsl:otherwise>
<!-- $endDay >= $startDay -->
<xsl:sequence select="$endMonth - $startMonth"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="numDays">
<!--<xsl:choose>
<xsl:when test="$numMonths &lt; 1 and $numYears &lt; 1">
<!-\- only displaying days if contract is for less than a month -\->
<xsl:sequence select="($enddate - $startdate) div xs:dayTimeDuration('P1D')"/>
</xsl:when>
<xsl:otherwise>
<!-\- if contract is longer than a month, don't count days -\->
<xsl:sequence select="0"/>
</xsl:otherwise>
</xsl:choose>-->
<xsl:choose>
<xsl:when test="$endDay - $startDay &lt; 0">
<xsl:value-of select="$startMonthNumberOfDays - $startDay + $endDay"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$endDay - $startDay"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$numYears > 0">
<xsl:sequence select="$numYears"/>
<xsl:text>year</xsl:text>
<xsl:if test="$numYears > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when
test="($numMonths > 0 and $numDays = 0) or ($numMonths = 0 and $numDays > 0)">
<xsl:text> and</xsl:text>
</xsl:when>
<xsl:when test="$numMonths > 0 and $numDays > 0">
<xsl:text>,</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:if>
<xsl:if test="$numMonths > 0">
<xsl:sequence select="$numMonths"/>
<xsl:text>month</xsl:text>
<xsl:if test="$numMonths > 1">
<xsl:text>s</xsl:text>
</xsl:if>
<xsl:if test="$numDays > 0">
<xsl:text> and</xsl:text>
</xsl:if>
</xsl:if>
<xsl:if test="$numDays > 0">
<xsl:sequence select="$numDays"/>
<xsl:text>day</xsl:text>
<xsl:if test="$numDays > 1">
<xsl:text>s</xsl:text>
</xsl:if>
</xsl:if>
</xsl:function>
</xsl:stylesheet>

View File

@@ -10,12 +10,10 @@
<xsl:choose>
<xsl:when
test="img | generate_piechart | p | div | table | section | ol | ul | pre">
<fo:block xsl:use-attribute-sets="censoredblock">
<xsl:call-template name="checkIfLast"/>
<xsl:text>[ CENSORED ]</xsl:text></fo:block>
<xsl:call-template name="censoredBlock"/>
</xsl:when>
<xsl:otherwise>
<fo:inline xsl:use-attribute-sets="censoredtext">[ CENSORED ]</fo:inline>
<xsl:call-template name="censoredInline"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
@@ -24,5 +22,7 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>

View File

@@ -4,15 +4,7 @@
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="2.0">
<!-- color scheme, just change these to change colors throughout the suite -->
<xsl:variable name="c_main">#e2632a</xsl:variable>
<xsl:variable name="c_support_light">#ededed</xsl:variable>
<xsl:variable name="c_support_subtlydarkerlight">#e4e4e4</xsl:variable><!-- used for subtle light border around support_light background -->
<xsl:variable name="c_support_medium">#999999</xsl:variable><!-- used for subtle light border around support_light background -->
<xsl:variable name="c_support_dark">#444444</xsl:variable>
<xsl:variable name="c_main_contrast">white</xsl:variable>
<xsl:variable name="border-color">#444444</xsl:variable>
<!-- Note: pie chart colors can be customized in functions_params_vars.xslt -->
<!-- variables -->

View File

@@ -8,13 +8,13 @@
<!-- Retest status colors -->
<xsl:attribute-set name="status-new"><!-- also used by unresolved -->
<xsl:attribute name="color">#CC4900</xsl:attribute>
<xsl:attribute name="color"><xsl:value-of select="$color_new"/></xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="status-resolved">
<xsl:attribute name="color">#b7aa5b</xsl:attribute>
<xsl:attribute name="color"><xsl:value-of select="$color_resolved"/></xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="status-not_retested">
<xsl:attribute name="color">#FE9920</xsl:attribute>
<xsl:attribute name="color"><xsl:value-of select="$color_notretested"/></xsl:attribute>
</xsl:attribute-set>
<!-- Text -->