| 1 |
<?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
|---|
| 3 |
<!-- To see the input used for this xslt, check the "Create source.xml file |
|---|
| 4 |
when creating report" menu item under the "Reports" menu in FsComp. |
|---|
| 5 |
When checked a .source.xml file is created each time you create a report. |
|---|
| 6 |
It shows the actual xml input to the xslt processor. |
|---|
| 7 |
This is helpfull if you like to modify this file. |
|---|
| 8 |
--> |
|---|
| 9 |
<xsl:output method="html" encoding="utf-8" indent="yes"/> |
|---|
| 10 |
<!-- Set the decimal separator to be used (. or ,) when decimal data is displayed. |
|---|
| 11 |
All decimal data in the source is with . and will be displayed with . unless |
|---|
| 12 |
formated otherwise using format-number() function. |
|---|
| 13 |
--> |
|---|
| 14 |
<xsl:variable name="decimal_separator" select="','"/> |
|---|
| 15 |
<xsl:decimal-format decimal-separator="," grouping-separator=" "/> |
|---|
| 16 |
<!-- note! make sure both above use same, ie either . or ,!! --> |
|---|
| 17 |
<!-- All <xsl:param ... elements will show as a field in a report dialog in |
|---|
| 18 |
FS when creating reports. This means you can define param elements here |
|---|
| 19 |
with a default value and set the value from FS when creating report. |
|---|
| 20 |
Some is used simply to display text at the top of the report (ie status), |
|---|
| 21 |
others is used to filter the results (ie women_only, nation, ...). |
|---|
| 22 |
If you add filter params you must of course also change the "filter" |
|---|
| 23 |
definition below so that the filter params is applied. |
|---|
| 24 |
--> |
|---|
| 25 |
<xsl:param name="Heading">Pilot List</xsl:param> |
|---|
| 26 |
<!-- filter params --> |
|---|
| 27 |
<!-- sort_on possible values: name, id, CIVLID --> |
|---|
| 28 |
<xsl:param name="sort_on">name</xsl:param> |
|---|
| 29 |
<xsl:param name="women_only">0</xsl:param> |
|---|
| 30 |
<xsl:param name="nation"/> |
|---|
| 31 |
<xsl:param name="custom_pilot_attribute_name"/> |
|---|
| 32 |
<xsl:param name="custom_pilot_attribute_value"/> |
|---|
| 33 |
<!-- The node-set that this variable returns is what is used |
|---|
| 34 |
to create the result list. |
|---|
| 35 |
Here some of the params above is used. |
|---|
| 36 |
--> |
|---|
| 37 |
<xsl:variable name="filter" select=" |
|---|
| 38 |
/Fs/FsCompetition/FsParticipants/FsParticipant[ |
|---|
| 39 |
($women_only=0 or @female=1) |
|---|
| 40 |
and ($nation='' or @nat_code_3166_a3=$nation) |
|---|
| 41 |
and ($custom_pilot_attribute_name='' or |
|---|
| 42 |
FsCustomAttributes/FsCustomAttribute/@name=$custom_pilot_attribute_name |
|---|
| 43 |
and FsCustomAttributes/FsCustomAttribute/@value=$custom_pilot_attribute_value) |
|---|
| 44 |
] |
|---|
| 45 |
"/> |
|---|
| 46 |
<!-- record template, used for each pilot in the ranked list of pilots --> |
|---|
| 47 |
<xsl:template name="record"> |
|---|
| 48 |
<tr> |
|---|
| 49 |
<td> |
|---|
| 50 |
<xsl:value-of select="@id"/> |
|---|
| 51 |
</td> |
|---|
| 52 |
<td> |
|---|
| 53 |
<xsl:value-of select="@CIVLID"/> |
|---|
| 54 |
</td> |
|---|
| 55 |
<td> |
|---|
| 56 |
<xsl:value-of select="@name"/> |
|---|
| 57 |
</td> |
|---|
| 58 |
<td> |
|---|
| 59 |
<xsl:choose> |
|---|
| 60 |
<xsl:when test="@female=1">F</xsl:when> |
|---|
| 61 |
<xsl:otherwise>M</xsl:otherwise> |
|---|
| 62 |
</xsl:choose> |
|---|
| 63 |
</td> |
|---|
| 64 |
<td> |
|---|
| 65 |
<xsl:value-of select="@nat_code_3166_a3"/> |
|---|
| 66 |
</td> |
|---|
| 67 |
<td> |
|---|
| 68 |
<xsl:value-of select="@glider"/> |
|---|
| 69 |
</td> |
|---|
| 70 |
<td> |
|---|
| 71 |
<xsl:value-of select="@sponsor"/> |
|---|
| 72 |
</td> |
|---|
| 73 |
<xsl:for-each select="FsCustomAttributes/FsCustomAttribute"> |
|---|
| 74 |
<!-- CustomAttributes rows --> |
|---|
| 75 |
<td> |
|---|
| 76 |
<xsl:value-of select="@value"/> |
|---|
| 77 |
</td> |
|---|
| 78 |
</xsl:for-each> |
|---|
| 79 |
</tr> |
|---|
| 80 |
</xsl:template> |
|---|
| 81 |
<xsl:template match="/"> |
|---|
| 82 |
<html> |
|---|
| 83 |
<head> |
|---|
| 84 |
<style> |
|---|
| 85 |
tr:hover {background: yellow;} |
|---|
| 86 |
body { |
|---|
| 87 |
font-family: Verdana, Arial, Helvetica, sans-serif; |
|---|
| 88 |
font-size: xx-small; |
|---|
| 89 |
} |
|---|
| 90 |
table |
|---|
| 91 |
{ |
|---|
| 92 |
border:solid 1px gray; |
|---|
| 93 |
border-collapse:collapse; |
|---|
| 94 |
font-size: xx-small; |
|---|
| 95 |
} |
|---|
| 96 |
td |
|---|
| 97 |
{ |
|---|
| 98 |
border:solid 1px gray; |
|---|
| 99 |
vertical-align:top; |
|---|
| 100 |
padding:5px; |
|---|
| 101 |
} |
|---|
| 102 |
th |
|---|
| 103 |
{ |
|---|
| 104 |
border:solid 1px gray; |
|---|
| 105 |
vertical-align:center; |
|---|
| 106 |
} |
|---|
| 107 |
</style> |
|---|
| 108 |
</head> |
|---|
| 109 |
<body> |
|---|
| 110 |
<div style="width:100%;font-size: xx-small;text-align:right;"> |
|---|
| 111 |
<i> |
|---|
| 112 |
Report created: <xsl:value-of select="/Fs/FsCompetition/FsParticipants/@ts"/> |
|---|
| 113 |
</i> |
|---|
| 114 |
</div> |
|---|
| 115 |
<h2> |
|---|
| 116 |
<xsl:value-of select="/Fs/FsCompetition/@name"/> |
|---|
| 117 |
</h2> |
|---|
| 118 |
<p style="font-size:xx-small"> |
|---|
| 119 |
<xsl:value-of select="/Fs/FsCompetition/@from"/> to <xsl:value-of select="/Fs/FsCompetition/@to"/> |
|---|
| 120 |
</p> |
|---|
| 121 |
<p> |
|---|
| 122 |
<xsl:value-of select="$Heading"/> |
|---|
| 123 |
</p> |
|---|
| 124 |
<br/> |
|---|
| 125 |
<table> |
|---|
| 126 |
<thead> |
|---|
| 127 |
<tr> |
|---|
| 128 |
<th>Id</th> |
|---|
| 129 |
<th>CIVLID</th> |
|---|
| 130 |
<th>Name</th> |
|---|
| 131 |
<th/> |
|---|
| 132 |
<th>Nat</th> |
|---|
| 133 |
<th>Glider</th> |
|---|
| 134 |
<th>Sponsor</th> |
|---|
| 135 |
<th>Phone</th> |
|---|
| 136 |
<th> |
|---|
| 137 |
<xsl:text>                         </xsl:text> |
|---|
| 138 |
</th> |
|---|
| 139 |
</tr> |
|---|
| 140 |
</thead> |
|---|
| 141 |
<!-- for each participant sorted on name --> |
|---|
| 142 |
<xsl:choose> |
|---|
| 143 |
<xsl:when test="$sort_on = 'id'"> |
|---|
| 144 |
<xsl:for-each select="$filter"> |
|---|
| 145 |
<xsl:sort select="@id" data-type="number" order="ascending"/> |
|---|
| 146 |
<!-- participant rows --> |
|---|
| 147 |
<xsl:call-template name="record"/> |
|---|
| 148 |
</xsl:for-each> |
|---|
| 149 |
</xsl:when> |
|---|
| 150 |
<xsl:when test="$sort_on = 'Id'"> |
|---|
| 151 |
<xsl:for-each select="$filter"> |
|---|
| 152 |
<xsl:sort select="@id" data-type="number" order="ascending"/> |
|---|
| 153 |
<!-- participant rows --> |
|---|
| 154 |
<xsl:call-template name="record"/> |
|---|
| 155 |
</xsl:for-each> |
|---|
| 156 |
</xsl:when> |
|---|
| 157 |
<xsl:when test="$sort_on = 'ID'"> |
|---|
| 158 |
<xsl:for-each select="$filter"> |
|---|
| 159 |
<xsl:sort select="@id" data-type="number" order="ascending"/> |
|---|
| 160 |
<!-- participant rows --> |
|---|
| 161 |
<xsl:call-template name="record"/> |
|---|
| 162 |
</xsl:for-each> |
|---|
| 163 |
</xsl:when> |
|---|
| 164 |
<xsl:when test="$sort_on = 'CIVLID'"> |
|---|
| 165 |
<xsl:for-each select="$filter"> |
|---|
| 166 |
<xsl:sort select="@CIVLID" data-type="number" order="ascending"/> |
|---|
| 167 |
<!-- participant rows --> |
|---|
| 168 |
<xsl:call-template name="record"/> |
|---|
| 169 |
</xsl:for-each> |
|---|
| 170 |
</xsl:when> |
|---|
| 171 |
<xsl:when test="$sort_on = 'civlid'"> |
|---|
| 172 |
<xsl:for-each select="$filter"> |
|---|
| 173 |
<xsl:sort select="@CIVLID" data-type="number" order="ascending"/> |
|---|
| 174 |
<!-- participant rows --> |
|---|
| 175 |
<xsl:call-template name="record"/> |
|---|
| 176 |
</xsl:for-each> |
|---|
| 177 |
</xsl:when> |
|---|
| 178 |
<xsl:when test="$sort_on = 'Civlid'"> |
|---|
| 179 |
<xsl:for-each select="$filter"> |
|---|
| 180 |
<xsl:sort select="@CIVLID" data-type="number" order="ascending"/> |
|---|
| 181 |
<!-- participant rows --> |
|---|
| 182 |
<xsl:call-template name="record"/> |
|---|
| 183 |
</xsl:for-each> |
|---|
| 184 |
</xsl:when> |
|---|
| 185 |
<xsl:otherwise> |
|---|
| 186 |
<xsl:for-each select="$filter"> |
|---|
| 187 |
<xsl:sort select="@name" data-type="text" order="ascending"/> |
|---|
| 188 |
<!-- participant rows --> |
|---|
| 189 |
<xsl:call-template name="record"/> |
|---|
| 190 |
</xsl:for-each> |
|---|
| 191 |
</xsl:otherwise> |
|---|
| 192 |
</xsl:choose> |
|---|
| 193 |
</table> |
|---|
| 194 |
</body> |
|---|
| 195 |
</html> |
|---|
| 196 |
</xsl:template> |
|---|
| 197 |
</xsl:stylesheet> |
|---|