Merge pull request #34 from radicallyopensecurity/nonfinding-ids
Implemented non-finding IDs
This commit is contained in:
commit
f4cf9cd056
@ -7,23 +7,34 @@
|
|||||||
<xsl:template match="finding" mode="number">
|
<xsl:template match="finding" mode="number">
|
||||||
<!-- Output finding display number (context is finding) -->
|
<!-- Output finding display number (context is finding) -->
|
||||||
<xsl:variable name="sectionNumber">
|
<xsl:variable name="sectionNumber">
|
||||||
<xsl:choose>
|
<xsl:if test="/pentest_report/@findingNumberingBase = 'Section'">
|
||||||
<xsl:when test="/pentest_report/@findingNumberingBase = 'Section'">
|
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
select="count(ancestor::section[last()]/preceding-sibling::section) + 1"/>
|
select="count(ancestor::section[last()]/preceding-sibling::section) + 1"/>
|
||||||
</xsl:when>
|
</xsl:if>
|
||||||
<xsl:otherwise>0</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="findingNumber" select="count(preceding::finding) + 1"/>
|
<xsl:variable name="findingNumber" select="count(preceding::finding) + 1"/>
|
||||||
<xsl:variable name="numFormat" select="'00'"/>
|
<xsl:variable name="numFormat">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="/pentest_report/@findingNumberingBase = 'Section'">00</xsl:when>
|
||||||
|
<xsl:otherwise>000</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
select="concat(ancestor::*[@findingCode][1]/@findingCode, '-', $sectionNumber, string(format-number($findingNumber, $numFormat)))"
|
select="concat(ancestor::*[@findingCode][1]/@findingCode, '-', $sectionNumber, string(format-number($findingNumber, $numFormat)))"
|
||||||
/>
|
/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="non-finding" mode="number">
|
||||||
|
<!-- Output finding display number (context is finding) -->
|
||||||
|
<xsl:variable name="nonFindingNumber" select="count(preceding::non-finding) + 1"/>
|
||||||
|
<xsl:variable name="numFormat" select="'000'"/>
|
||||||
|
<xsl:value-of
|
||||||
|
select="concat('NF-', string(format-number($nonFindingNumber, $numFormat)))"
|
||||||
|
/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template
|
<xsl:template
|
||||||
match="section[not(@visibility = 'hidden')] | appendix[not(@visibility = 'hidden')] | non-finding"
|
match="section[not(@visibility = 'hidden')] | appendix[not(@visibility = 'hidden')]"
|
||||||
mode="number">
|
mode="number">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$EXEC_SUMMARY = true()">
|
<xsl:when test="$EXEC_SUMMARY = true()">
|
||||||
@ -83,4 +94,19 @@
|
|||||||
</fo:inline>
|
</fo:inline>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="prependNumber">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="parent::finding">
|
||||||
|
<!-- prepend finding id (XXX-NNN) -->
|
||||||
|
<xsl:apply-templates select=".." mode="number"/>
|
||||||
|
<xsl:text> — </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="parent::non-finding">
|
||||||
|
<!-- prepend non-finding id (NF-NNN) -->
|
||||||
|
<xsl:apply-templates select=".." mode="number"/>
|
||||||
|
<xsl:text> — </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
@ -93,11 +93,7 @@
|
|||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:text>   </xsl:text>
|
<xsl:text>   </xsl:text>
|
||||||
<xsl:if test="parent::finding">
|
<xsl:call-template name="prependNumber"/>
|
||||||
<!-- prepend finding id (XXX-NNN) -->
|
|
||||||
<xsl:apply-templates select=".." mode="number"/>
|
|
||||||
<xsl:text> — </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
<xsl:if test="parent::finding">
|
<xsl:if test="parent::finding">
|
||||||
|
|||||||
@ -90,12 +90,7 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="title" mode="toc">
|
<xsl:template match="title" mode="toc">
|
||||||
<xsl:if test="parent::finding">
|
<xsl:call-template name="prependNumber"/>
|
||||||
<!-- prepend finding id (XXX-NNN) -->
|
|
||||||
<xsl:apply-templates select=".." mode="number"/>
|
|
||||||
<xsl:text> — </xsl:text>
|
|
||||||
</xsl:if>
|
|
||||||
<!--<xsl:apply-templates select="text()|*/text()"/>-->
|
|
||||||
<xsl:apply-templates/>
|
<xsl:apply-templates/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user