Skip to content

Commit ac13103

Browse files
author
dreizehnutters
committed
added QoL features
1 parent 0b83680 commit ac13103

13 files changed

Lines changed: 20738 additions & 10196 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

samples/nmap-scan.xml

Lines changed: 0 additions & 9690 deletions
This file was deleted.

tests/nmap-scan.xml

Lines changed: 19282 additions & 0 deletions
Large diffs are not rendered by default.

tests/validate_xsl_tooling.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ done
2222

2323
python3 tools/build_xsl.py xsl/main.xsl "$TMP_DIR/built.xsl"
2424
xmllint --noout "$TMP_DIR/built.xsl"
25-
xsltproc -o "$TMP_DIR/report.html" "$TMP_DIR/built.xsl" samples/nmap-scan.xml
25+
xsltproc -o "$TMP_DIR/report.html" "$TMP_DIR/built.xsl" tests/nmap-scan.xml
2626

2727
echo "XSL tooling validation passed"

tools/release_xsl.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

xsl/helpers.xsl

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,47 @@
1414
</xsl:choose>
1515
</xsl:template>
1616

17+
<xsl:template name="render-ipv4-sort-key">
18+
<xsl:param name="address"/>
19+
<xsl:variable name="octet-1" select="substring-before($address, '.')"/>
20+
<xsl:variable name="rest-1" select="substring-after($address, '.')"/>
21+
<xsl:variable name="octet-2" select="substring-before($rest-1, '.')"/>
22+
<xsl:variable name="rest-2" select="substring-after($rest-1, '.')"/>
23+
<xsl:variable name="octet-3" select="substring-before($rest-2, '.')"/>
24+
<xsl:variable name="octet-4" select="substring-after($rest-2, '.')"/>
25+
<xsl:value-of select="concat(
26+
'4-',
27+
format-number(number($octet-1), '000'),
28+
'.',
29+
format-number(number($octet-2), '000'),
30+
'.',
31+
format-number(number($octet-3), '000'),
32+
'.',
33+
format-number(number($octet-4), '000')
34+
)"/>
35+
</xsl:template>
36+
37+
<xsl:template name="render-address-sort-key">
38+
<xsl:param name="address"/>
39+
<xsl:variable name="normalized-address" select="normalize-space($address)"/>
40+
<xsl:choose>
41+
<xsl:when test="string($normalized-address) = '' or $normalized-address = 'N/A'">
42+
<xsl:text></xsl:text>
43+
</xsl:when>
44+
<xsl:when test="contains($normalized-address, '.') and not(contains($normalized-address, ':'))">
45+
<xsl:call-template name="render-ipv4-sort-key">
46+
<xsl:with-param name="address" select="$normalized-address"/>
47+
</xsl:call-template>
48+
</xsl:when>
49+
<xsl:when test="contains($normalized-address, ':')">
50+
<xsl:value-of select="concat('6-', translate($normalized-address, 'ABCDEF', 'abcdef'))"/>
51+
</xsl:when>
52+
<xsl:otherwise>
53+
<xsl:value-of select="concat('z-', translate($normalized-address, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'))"/>
54+
</xsl:otherwise>
55+
</xsl:choose>
56+
</xsl:template>
57+
1758
<xsl:template name="extract-first-dns-name">
1859
<xsl:param name="text"/>
1960
<xsl:variable name="normalized-text" select="normalize-space($text)"/>
@@ -338,6 +379,8 @@
338379
<xsl:param name="secondary" select="''"/>
339380
<xsl:param name="row-class" select="''"/>
340381
<xsl:param name="value-class" select="''"/>
382+
<xsl:param name="data-valid-from" select="''"/>
383+
<xsl:param name="data-valid-to" select="''"/>
341384
<xsl:if test="string($primary) != '' or string($secondary) != ''">
342385
<div>
343386
<xsl:attribute name="class">
@@ -359,6 +402,16 @@
359402
<xsl:value-of select="$value-class"/>
360403
</xsl:if>
361404
</xsl:attribute>
405+
<xsl:if test="string($data-valid-from) != ''">
406+
<xsl:attribute name="data-valid-from">
407+
<xsl:value-of select="$data-valid-from"/>
408+
</xsl:attribute>
409+
</xsl:if>
410+
<xsl:if test="string($data-valid-to) != ''">
411+
<xsl:attribute name="data-valid-to">
412+
<xsl:value-of select="$data-valid-to"/>
413+
</xsl:attribute>
414+
</xsl:if>
362415
<xsl:value-of select="$primary"/>
363416
<xsl:if test="string($secondary) != ''">
364417
<xsl:text> – </xsl:text>

0 commit comments

Comments
 (0)