-
Notifications
You must be signed in to change notification settings - Fork 0
/
report_weekly.xsl
64 lines (53 loc) · 2.69 KB
/
report_weekly.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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:output method="text"/>
<!-- Determine week based on parameter input -->
<xsl:param name="monday" select="'2022-08-01'"/>
<xsl:variable name="l1_bullet" select="'* '"/>
<xsl:variable name="l2_bullet" select="' * '"/>
<xsl:template match="@*|node()">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="week[@monday = $monday]">
<!-- Output to document; construct filename+path from input date -->
<xsl:result-document href="{substring($monday,1,4)}/weekly_{$monday}.md">
<!-- Construct header using date -->
<xsl:text># Weekly Report -- Monday </xsl:text>
<xsl:value-of select="format-date(xs:date($monday), '[MNn] [D], [Y0001]')"/>
<xsl:text> </xsl:text>
<!-- List tasks noted as reportable for department standup -->
<xsl:text>## Department Meeting Report </xsl:text>
<xsl:for-each-group select="task[reporting/reporting_level/@value != 'none']" group-by="description/project">
<xsl:value-of select="concat($l1_bullet,current-grouping-key() )"/>
<xsl:for-each select="current-group()">
<xsl:text> </xsl:text>
<xsl:value-of select="$l2_bullet"/>
<xsl:value-of select="reporting/narrative"/>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:for-each-group>
<xsl:for-each select="task[not(description/project)]">
<xsl:value-of select="$l1_bullet"/>
<xsl:value-of select="reporting/narrative"/>
<xsl:text> </xsl:text>
</xsl:for-each>
<xsl:text> </xsl:text>
<!--
<!-\- Compute time spent in PD areas and compare to FTE percents -\->
<xsl:text>## FTE Check </xsl:text>
<xsl:for-each select="task/tracking/time">
<xsl:variable name="time_spent">
<xsl:value-of select="xs:time(end)-xs:time(start)"/>
</xsl:variable>
<xsl:value-of select="$time_spent"/>
<xsl:text> </xsl:text>
</xsl:for-each>
-->
<xsl:text> </xsl:text>
</xsl:result-document>
</xsl:template>
<!--//task[position()=last()]/tracking/time/[xs:time(end)] - //task[position()=last()]/tracking/time/xs:time(start)-->
</xsl:stylesheet>