Fixes + cover for generic document

This commit is contained in:
skyanth 2019-02-12 15:28:17 +01:00
parent 3ac447d976
commit 46e50037b3
7 changed files with 77 additions and 221 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

View File

@ -25,4 +25,9 @@
https://creativecommons.org/licenses/by-sa/3.0/legalcode</attribution>
</file>
</doctype>
<doctype name="generic_document">
<file name="frontpage_doc_1.jpg">
<attribution>Front page styling by Patricia Piolon</attribution>
</file>
</doctype>
</frontpage_graphics>

View File

@ -7,7 +7,7 @@
<xsl:param name="AUTO_NUMBERING_FORMAT" select="'1.1.1'"/>
<!-- executive summary (report only) -->
<xsl:param name="EXEC_SUMMARY" select="true()"/>
<xsl:param name="EXEC_SUMMARY" select="false()"/>
<!-- language parameter for localization (quote & invoice) -->
<xsl:param name="lang" select="/*/@xml:lang"/>

View File

@ -31,7 +31,7 @@
<fo:root>
<xsl:call-template name="layout-master-set"/>
<xsl:call-template name="Content">
<xsl:with-param name="execsummary" select="'no'" tunnel="yes"/>
<xsl:with-param name="execsummary" select="false()" tunnel="yes"/>
</xsl:call-template>
</fo:root>
</xsl:template>

View File

@ -9,7 +9,6 @@
<xsl:import href="meta.xslt"/>
<xsl:import href="toc.xslt"/>
<xsl:import href="structure.xslt"/>
<xsl:import href="att-set.xslt"/>
<xsl:import href="block.xslt"/>
<xsl:import href="auto.xslt"/>
<xsl:import href="table.xslt"/>
@ -25,176 +24,24 @@
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:include href="functions_params_vars.xslt"/>
<!-- numbered titles or not? -->
<xsl:param name="NUMBERING" select="true()"/>
<!-- ROOT -->
<xsl:template match="/">
<fo:root xsl:use-attribute-sets="root-common">
<xsl:call-template name="layout-master-set"/>
<xsl:call-template name="FrontMatter"/>
<xsl:call-template name="FrontMatter">
<xsl:with-param name="execsummary" select="false()" tunnel="yes"/>
</xsl:call-template>
<xsl:call-template name="Content">
<xsl:with-param name="execsummary" select="'no'" tunnel="yes"/>
<xsl:with-param name="execsummary" select="false()" tunnel="yes"/>
</xsl:call-template>
</fo:root>
</xsl:template>
<!-- OVERRIDES -->
<xsl:template match="meta" mode="frontmatter">
<xsl:param name="execsummary" tunnel="yes"/>
<xsl:variable name="latestVersionNumber">
<xsl:for-each select="version_history/version">
<xsl:sort select="xs:dateTime(@date)" order="descending"/>
<xsl:if test="position() = 1">
<xsl:call-template name="VersionNumber">
<xsl:with-param name="number" select="@number"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="reporttitle">
<xsl:value-of select="title"/>
</xsl:variable>
<xsl:variable name="words" select="tokenize($reporttitle, '\s')"/>
<fo:block xsl:use-attribute-sets="frontpagetext">
<fo:block xsl:use-attribute-sets="title-0">
<xsl:for-each select="$words">
<xsl:choose>
<xsl:when
test="
. = 'And' or
. = 'and' or
. = 'Or' or
. = 'or' or
. = 'The' or
. = 'the' or
. = 'Of' or
. = 'of' or
. = 'A' or
. = 'a'">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<fo:block/>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</fo:block>
<fo:block xsl:use-attribute-sets="frontpagesubtitle">
<xsl:sequence
select="
string-join(for $x in tokenize(//subtitle, ' ')
return
my:titleCase($x), ' ')"
/>
</fo:block>
<fo:block xsl:use-attribute-sets="title-date">
<xsl:value-of select="$latestVersionDate"/>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template name="cover_footer">
<fo:static-content flow-name="region-after-cover" xsl:use-attribute-sets="FooterFont">
<fo:block xsl:use-attribute-sets="footer coverfooter">
<fo:block>
<xsl:value-of select="//meta/company/coc"/>
</fo:block>
</fo:block>
</fo:static-content>
</xsl:template>
<xsl:template name="DocProperties">
<xsl:variable name="latestVersionNumber">
<xsl:for-each select="version_history/version">
<xsl:sort select="xs:dateTime(@date)" order="descending"/>
<xsl:if test="position() = 1">
<xsl:call-template name="VersionNumber">
<xsl:with-param name="number" select="@number"/>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="authors"
select="version_history/version/v_author[not(. = ../preceding::version/v_author)]"/>
<fo:block xsl:use-attribute-sets="title-4">Document Properties</fo:block>
<fo:block margin-bottom="{$very-large-space}">
<fo:table width="100%" table-layout="fixed" xsl:use-attribute-sets="borders">
<fo:table-column column-width="proportional-column-width(25)"
xsl:use-attribute-sets="bg-orange borders"/>
<fo:table-column column-width="proportional-column-width(75)"/>
<fo:table-body>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>Title</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:value-of select="title"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>Version</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:value-of select="$latestVersionNumber"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>Author<xsl:if test="$authors[2]">s</xsl:if></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:for-each select="$authors">
<xsl:if test="preceding::v_author">
<xsl:text>, </xsl:text>
</xsl:if>
<fo:inline>
<xsl:value-of select="."/>
</fo:inline>
</xsl:for-each>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>Reviewed by</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:for-each select="collaborators/reviewers/reviewer">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>Approved by</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:value-of select="collaborators/approver/name"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:template>
<!-- Don't want tabs in generic documents -->
<xsl:template name="getTabMarker"/>
</xsl:stylesheet>

View File

@ -120,16 +120,18 @@
<fo:table-column column-width="proportional-column-width(25)"/>
<fo:table-column column-width="proportional-column-width(75)"/>
<fo:table-body>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Client</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:value-of select="//client/full_name"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:if test="not(/generic_document)">
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Client</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:value-of select="//client/full_name"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Title</fo:block>
@ -154,31 +156,33 @@
</xsl:choose>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Target<xsl:if test="targets/target[2]">s</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:choose>
<xsl:when test="targets/target[2]">
<!-- more than one target -->
<xsl:for-each select="targets/target">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
<!-- end list -->
</xsl:when>
<xsl:otherwise>
<!-- just the one -->
<xsl:value-of select="targets/target"/>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:table-cell>
</fo:table-row>
<xsl:if test="not(/generic_document)">
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Target<xsl:if test="targets/target[2]">s</xsl:if>
</fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:choose>
<xsl:when test="targets/target[2]">
<!-- more than one target -->
<xsl:for-each select="targets/target">
<fo:block>
<xsl:value-of select="."/>
</fo:block>
</xsl:for-each>
<!-- end list -->
</xsl:when>
<xsl:otherwise>
<!-- just the one -->
<xsl:value-of select="targets/target"/>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Version</fo:block>
@ -189,24 +193,27 @@
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Pentester<xsl:if test="collaborators/pentesters/pentester[2]"
<xsl:if test="not(/generic_document)">
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Pentester<xsl:if
test="collaborators/pentesters/pentester[2]"
>s</xsl:if></fo:block>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:for-each select="collaborators/pentesters/pentester">
<fo:inline>
<xsl:value-of select="name"/>
</fo:inline>
<xsl:if test="following-sibling::pentester">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="td">
<fo:block>
<xsl:for-each select="collaborators/pentesters/pentester">
<fo:inline>
<xsl:value-of select="name"/>
</fo:inline>
<xsl:if test="following-sibling::pentester">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:for-each>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:if>
<fo:table-row xsl:use-attribute-sets="borders">
<fo:table-cell xsl:use-attribute-sets="th">
<fo:block>Author<xsl:if test="$authors[2]">s</xsl:if></fo:block>
@ -428,9 +435,6 @@
select="document('../graphics/frontpage_graphics.xml')/frontpage_graphics/doctype[@name = $doctype]"/>
<xsl:variable name="available_frontpage_graphics" select="count($graphicsdoc/file)"/>
<xsl:message>
<xsl:value-of select="$current_second"/>
</xsl:message>
<!-- taking the current second as a 'random number generator' -->
<xsl:variable name="selected_graphic"
select="ceiling(number($available_frontpage_graphics div 60 * $current_second))"/>

View File

@ -45,7 +45,7 @@
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="tocCell">
<fo:block>
<xsl:if test="parent::pentest_report">
<xsl:if test="parent::pentest_report or parent::generic_document">
<!-- We're in a top-level section, so add some extra styling -->
<xsl:call-template name="topLevelToCEntry"/>
</xsl:if>
@ -59,7 +59,7 @@
</fo:table-cell>
<fo:table-cell xsl:use-attribute-sets="tocCell">
<fo:block>
<xsl:if test="parent::pentest_report">
<xsl:if test="parent::pentest_report or parent::generic_document">
<!-- We're in a top-level section, so add some extra styling -->
<xsl:call-template name="topLevelToCEntry"/>
</xsl:if>
@ -74,7 +74,7 @@
<fo:table-cell padding-right="3pt" display-align="after"
xsl:use-attribute-sets="tocCell">
<fo:block text-align="right">
<xsl:if test="parent::pentest_report">
<xsl:if test="parent::pentest_report or parent::generic_document">
<!-- We're in a top-level section, so add some extra styling -->
<xsl:call-template name="topLevelToCEntry"/>
</xsl:if>