1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
2 | |
---|
3 | <xsl:stylesheet version="3.0" |
---|
4 | xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" |
---|
5 | xmlns:ibis="http://www.ibisph.org" |
---|
6 | |
---|
7 | exclude-result-prefixes="ibis" |
---|
8 | > |
---|
9 | <!-- garth todo: |
---|
10 | <xsl:import href="../../../json/Dataset.xslt"/> |
---|
11 | <xsl:import href="../../../json/Kendo.xslt"/> |
---|
12 | --> |
---|
13 | <xsl:import href="../../HTMLContentPage.xslt"/> |
---|
14 | <xsl:import href="../Page.xslt"/> |
---|
15 | <xsl:import href="SiteSpecific.xslt"/> |
---|
16 | |
---|
17 | |
---|
18 | <ibis:doc> |
---|
19 | <name>html/community/facts/Page</name> |
---|
20 | <summary> |
---|
21 | Provides the Special Introduction Overrides to be able to process |
---|
22 | both the community dimension file and the 'HTML_CONTENT' file to |
---|
23 | produce the intro/quick facts page. |
---|
24 | </summary> |
---|
25 | <description> |
---|
26 | </description> |
---|
27 | </ibis:doc> |
---|
28 | |
---|
29 | |
---|
30 | <xsl:param name="ShowMap" select="false"/> |
---|
31 | |
---|
32 | |
---|
33 | <xsl:param name="Page.pageTitle" ibis:doc="Page's browser title text." |
---|
34 | select="concat(Page.communityTitle, ' Quick Facts')" |
---|
35 | /> |
---|
36 | <xsl:param name="Page.contentTitle" ibis:doc="Page's content title text." |
---|
37 | select="concat('Quick Facts for ', $Page.communityTitle)" |
---|
38 | /> |
---|
39 | |
---|
40 | <xsl:param name="Page.communityTitle" ibis:doc="Page's community title text." |
---|
41 | select="concat( |
---|
42 | $Page.communityDimensionValue/TITLE, |
---|
43 | ' ', |
---|
44 | ibis:getDimensionTitle($Page.communityDimension) |
---|
45 | )" |
---|
46 | /> |
---|
47 | |
---|
48 | |
---|
49 | <xsl:variable name="Page.demographicPublishedIndicators" select="document( ibis:getContentPath('xml/indicator/published_indicators.xml'), /)//PUBLISHED_INDICATOR[DEMOGRAPHIC_FLAG = 'x']"/> |
---|
50 | <xsl:variable name="Page.communityDemographicPublishedIndicators" select="$Page.demographicPublishedIndicators//DIMENSION_COMBINATION[(DIMENSION_1/NAME = $Page.dimensionName) and not(DIMENSION_2)]"/> |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | <xsl:template name="Page.contentBody" ibis:doc="HTML API template implementation |
---|
55 | that provides main HTML body content for the page. Defaults to copying |
---|
56 | all elements and attributes of the the 'HTML_CONTENT/CONTENT' element." |
---|
57 | > |
---|
58 | <style> |
---|
59 | .Overview |
---|
60 | { |
---|
61 | margin-top: 2em; |
---|
62 | vertical-align: top; |
---|
63 | max-width: 60%; |
---|
64 | min-width: 300px; |
---|
65 | } |
---|
66 | .Overview img |
---|
67 | { |
---|
68 | display: inline-block; |
---|
69 | float: left; |
---|
70 | padding-right: 1rem; |
---|
71 | } |
---|
72 | |
---|
73 | .Overview, .GoogleMap {display: inline-block;} |
---|
74 | .GoogleMap |
---|
75 | { |
---|
76 | max-width: 30%; |
---|
77 | min-width: 300px; |
---|
78 | padding: 1em 2rem 0 2rem; |
---|
79 | } |
---|
80 | |
---|
81 | table.Info, .Note |
---|
82 | { |
---|
83 | margin-top: 1.5rem; |
---|
84 | } |
---|
85 | .Note ul |
---|
86 | { |
---|
87 | list-style: none; |
---|
88 | } |
---|
89 | </style> |
---|
90 | |
---|
91 | <xsl:call-template name="Page.contentOptions"> |
---|
92 | <xsl:with-param name="title" select="'Quick Facts Report Options'"/> |
---|
93 | </xsl:call-template> |
---|
94 | |
---|
95 | <xsl:apply-templates select="HTML_CONTENT/CONTENT/(text() | *)" mode="ibis.copy"/> |
---|
96 | |
---|
97 | <div class="Note"> |
---|
98 | This report is possible because of the work of all the NMDOH Data Stewards |
---|
99 | who maintain our health datasets, the NMDOH Indicator Report Authors and |
---|
100 | Editors who create and maintain the NM-IBIS indicator reports on which |
---|
101 | this report is based, and the people of New Mexico who support their efforts. |
---|
102 | </div> |
---|
103 | </xsl:template> |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | <xsl:template match="ibis:Page.demographicIndicators" mode="ibis.copy"> |
---|
108 | <table class="Info" title="table of demographics for this community"> |
---|
109 | <thead><tr> |
---|
110 | <th>Demographics</th> |
---|
111 | <th class="Value"><xsl:value-of select="$Page.communityTitle"/></th> |
---|
112 | <th class="Value"><xsl:value-of select="$Page.stateTitle"/></th> |
---|
113 | <th class="Value">U.S.</th> |
---|
114 | </tr></thead> |
---|
115 | |
---|
116 | <xsl:for-each select="$Page.demographicPublishedIndicators"> |
---|
117 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
118 | <xsl:sort select="NAME" data-type="text" order="ascending"/> |
---|
119 | |
---|
120 | <xsl:variable name="indicator" select="document(concat($Page.indicatorProfileXMLFilePath, '/', NAME, '.xml'), /)/INDICATOR"/> |
---|
121 | <xsl:variable name="indicatorComparisonValues"> |
---|
122 | <xsl:call-template name="ComparisonValues.getIndicatorStateUSComparisonValues"> |
---|
123 | <xsl:with-param name="indicator" select="$indicator"/> |
---|
124 | <xsl:with-param name="dimensions" select="$Page.dimensions"/> |
---|
125 | <xsl:with-param name="measures" select="$Page.measures"/> |
---|
126 | <xsl:with-param name="valueTypes" select="$Page.valueTypes"/> |
---|
127 | <xsl:with-param name="communityDimensionName" select="$Page.dimensionName"/> |
---|
128 | <xsl:with-param name="communityDimensionValue" select="$Page.dimensionValue"/> |
---|
129 | </xsl:call-template> |
---|
130 | </xsl:variable> |
---|
131 | |
---|
132 | <tr class="Value"> |
---|
133 | <th><a href="{ibis:getRequestURL(concat('indicator/summary/', $indicator/NAME, '.html'))}"> |
---|
134 | <xsl:value-of select="ibis:getIndicatorTitle($indicator)"/> (<xsl:value-of select="$indicatorComparisonValues/PERIOD_DIMENSION/VALUE/TITLE"/>) |
---|
135 | </a> </th> |
---|
136 | <td><xsl:value-of select="$indicatorComparisonValues/COMMUNITY/VALUE/TITLE"/></td> |
---|
137 | <td><xsl:value-of select="$indicatorComparisonValues/STATE/VALUE/TITLE"/></td> |
---|
138 | <td><xsl:value-of select="$indicatorComparisonValues/US/VALUE/TITLE"/></td> |
---|
139 | </tr> |
---|
140 | </xsl:for-each> |
---|
141 | </table> |
---|
142 | </xsl:template> |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | <xsl:template match="ibis:Page.indicatorsChart" mode="ibis.copy"> |
---|
148 | <xsl:param name="chartName" select="CHART_NAME"/> |
---|
149 | <xsl:param name="measureName" select="MEASURE_NAME"/> |
---|
150 | <xsl:param name="indicatorSetName" select="INDICATOR_SET_NAME"/> |
---|
151 | |
---|
152 | <xsl:apply-templates select="HEADER_CONTENT/*" mode="ibis.copy"/> |
---|
153 | <div class="DataViz"> |
---|
154 | <h3><xsl:value-of select="TITLE"/></h3> |
---|
155 | <div id="{DATAVIZ_ID}" class="{DATAVIZ_CLASSES}"> |
---|
156 | </div> |
---|
157 | </div> |
---|
158 | <xsl:apply-templates select="FOOTER_CONTENT/*" mode="ibis.copy"/> |
---|
159 | |
---|
160 | |
---|
161 | <xsl:variable name="indicatorSet" select="document( ibis:getContentPath('xml/indicator/indicator_sets.xml'), /)//INDICATOR_SET[NAME = $Page.indicatorSetName]"/> |
---|
162 | <xsl:variable name="values"> |
---|
163 | <xsl:for-each select="$indicatorSet/INDICATOR_TO_INDICATOR_SETS/INDICATOR_TO_INDICATOR_SET/INDICATOR_NAME"> |
---|
164 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
165 | <xsl:sort select="INDICATOR_NAME" data-type="text" order="ascending"/> |
---|
166 | |
---|
167 | <xsl:call-template name="indicatorProfileRow"> |
---|
168 | <xsl:with-param name="indicatorName" select="current()"/> |
---|
169 | <xsl:with-param name="measureName" select="/HTML_CONTENT/PARAMETERS/PARAMETER[NAME='MeasureName']/VALUE"/> |
---|
170 | </xsl:call-template> |
---|
171 | </xsl:for-each> |
---|
172 | </xsl:variable> |
---|
173 | |
---|
174 | <xsl:variable name="communityCSV"> |
---|
175 | <xsl:for-each select="$values/INDICATOR_RECORD/COMMUNITY/VALUE/text()"> |
---|
176 | <xsl:if test="position() != 1">, </xsl:if> |
---|
177 | <xsl:value-of select="."/> |
---|
178 | </xsl:for-each> |
---|
179 | </xsl:variable> |
---|
180 | <xsl:variable name="stateCSV"> |
---|
181 | <xsl:for-each select="$values/INDICATOR_RECORD/STATE/VALUE/text()"> |
---|
182 | <xsl:if test="position() != 1">, </xsl:if> |
---|
183 | <xsl:value-of select="."/> |
---|
184 | </xsl:for-each> |
---|
185 | </xsl:variable> |
---|
186 | <xsl:variable name="usCSV"> |
---|
187 | <xsl:for-each select="$values/INDICATOR_RECORD/US/VALUE/text()"> |
---|
188 | <xsl:if test="position() != 1">, </xsl:if> |
---|
189 | <xsl:value-of select="."/> |
---|
190 | </xsl:for-each> |
---|
191 | </xsl:variable> |
---|
192 | |
---|
193 | <xsl:variable name="indicatorTitleCSV"> |
---|
194 | <xsl:for-each select="$values/INDICATOR_RECORD/TITLE"> |
---|
195 | <xsl:if test="position() != 1">, </xsl:if> |
---|
196 | "<xsl:value-of select="."/>" |
---|
197 | </xsl:for-each> |
---|
198 | </xsl:variable> |
---|
199 | |
---|
200 | <script> |
---|
201 | var kendoChartConstructorJSON = $.extend(true |
---|
202 | ,{} |
---|
203 | ,<xsl:call-template name="Kendo.namedConfigurationJSON"> |
---|
204 | <xsl:with-param name="configurationName" select="/HTML_CONTENT/PARAMETERS/PARAMETER[NAME='ChartName']/VALUE"/> |
---|
205 | </xsl:call-template> |
---|
206 | ,{ |
---|
207 | "title": |
---|
208 | { |
---|
209 | "text": "<xsl:value-of select="$indicatorSet/TITLE"/>" |
---|
210 | } |
---|
211 | ,"series": |
---|
212 | [ |
---|
213 | { |
---|
214 | "name": "<xsl:value-of select="distinct-values($values/INDICATOR_RECORD/COMMUNITY/TITLE)"/>" |
---|
215 | ,"data": [<xsl:value-of select="$communityCSV"/>] |
---|
216 | } |
---|
217 | ,{ |
---|
218 | "name": "<xsl:value-of select="distinct-values($values/INDICATOR_RECORD/STATE/TITLE)"/>" |
---|
219 | ,"data": [<xsl:value-of select="$stateCSV"/>] |
---|
220 | } |
---|
221 | ,{ |
---|
222 | "name": "<xsl:value-of select="distinct-values($values/INDICATOR_RECORD/US/TITLE)"/>" |
---|
223 | ,"data": [<xsl:value-of select="$usCSV"/>] |
---|
224 | } |
---|
225 | ] |
---|
226 | ,"valueAxis": |
---|
227 | { |
---|
228 | "title": {"text": "<xsl:value-of select="$values/INDICATOR_RECORD[1]/MEASURE/TITLE"/>"} |
---|
229 | } |
---|
230 | ,"categoryAxis": |
---|
231 | { |
---|
232 | "categories": [<xsl:value-of select="$indicatorTitleCSV"/>] |
---|
233 | } |
---|
234 | } |
---|
235 | ); |
---|
236 | |
---|
237 | $(document).ready( |
---|
238 | function() |
---|
239 | { |
---|
240 | console.log(kendoChartConstructorJSON); |
---|
241 | $("#chart").kendoChart(kendoChartConstructorJSON); |
---|
242 | } |
---|
243 | ); |
---|
244 | </script> |
---|
245 | |
---|
246 | </xsl:template> |
---|
247 | |
---|
248 | |
---|
249 | |
---|
250 | <xsl:template name="indicatorProfileRow" |
---|
251 | ibis:doc="Handles the xml/community/DIMENSION.xml type file. Which is of |
---|
252 | the struct: COMMUNITY_PROFILE, OVERVIEWS, DIMENSION, INDICATOR_PROFILES |
---|
253 | /INDICATOR_PROFILE/COMPARATIVE_VALUES/COMPARATIVE_VALUE/ TYPE, SERIES, |
---|
254 | CAT. |
---|
255 | " |
---|
256 | > |
---|
257 | <xsl:param name="indicatorName"/> |
---|
258 | <xsl:param name="indicator" select="document(concat($Page.indicatorProfileXMLFilePath, '/', $indicatorName, '.xml'), /)/INDICATOR"/> |
---|
259 | <xsl:param name="measureName"/> |
---|
260 | |
---|
261 | <xsl:if test="not($indicator/*)"><xsl:message select="concat('IP NOT FOUND: ', $indicatorName)"/></xsl:if> |
---|
262 | <xsl:if test="$indicator/*"> |
---|
263 | <xsl:variable name="indicatorComparisonValues"> |
---|
264 | <xsl:call-template name="ComparisonValues.getIndicatorStateUSComparisonValues"> |
---|
265 | <xsl:with-param name="indicator" select="$indicator"/> |
---|
266 | <xsl:with-param name="communityDimensionName" select="$Page.dimensionName"/> |
---|
267 | <xsl:with-param name="communityDimensionValue" select="$Page.dimensionValue"/> |
---|
268 | <xsl:with-param name="measureName"/> |
---|
269 | <xsl:with-param name="dimensions" select="$Page.dimensions"/> |
---|
270 | <xsl:with-param name="measures" select="$Page.measures"/> |
---|
271 | <xsl:with-param name="valueTypes" select="$Page.valueTypes"/> |
---|
272 | </xsl:call-template> |
---|
273 | </xsl:variable> |
---|
274 | |
---|
275 | <xsl:if test="$indicatorComparisonValues/*"> |
---|
276 | <INDICATOR_RECORD> |
---|
277 | <xsl:copy-of select="$indicator/TITLE"/> |
---|
278 | <xsl:copy-of select="$indicatorComparisonValues"/> |
---|
279 | </INDICATOR_RECORD> |
---|
280 | </xsl:if> |
---|
281 | </xsl:if> |
---|
282 | </xsl:template> |
---|
283 | |
---|
284 | |
---|
285 | <xsl:template match="ibis:Page.indicatorSetsSelection" mode="ibis.copy"> |
---|
286 | GARTH: <xsl:value-of select="$Page.indicatorSetName"/> |
---|
287 | <select name="indicatorSetName" id="indicatorSetName" |
---|
288 | onchange="requestDifferentIndicatorSet()" |
---|
289 | > |
---|
290 | <xsl:for-each select="$Page.communityIndicatorSet"> |
---|
291 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
292 | <xsl:sort select="TITLE" order="ascending"/> |
---|
293 | <option value="{NAME}"> |
---|
294 | <xsl:if test="NAME = $Page.indicatorSetName"> |
---|
295 | <xsl:attribute name="selected" select="'selected'"/> |
---|
296 | </xsl:if> |
---|
297 | <xsl:value-of select="TITLE"/> |
---|
298 | </option> |
---|
299 | </xsl:for-each> |
---|
300 | </select> |
---|
301 | </xsl:template> |
---|
302 | |
---|
303 | </xsl:stylesheet> |
---|
304 | <!-- ============================= End of File ============================= --> |
---|