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 | <xsl:call-template name="Page.contentOptions"> |
---|
59 | <xsl:with-param name="title" select="'Quick Facts Report Options'"/> |
---|
60 | </xsl:call-template> |
---|
61 | |
---|
62 | <xsl:apply-templates select="HTML_CONTENT/CONTENT/(text() | *)" mode="ibis.copy"/> |
---|
63 | |
---|
64 | <div class="Note"> |
---|
65 | This report is possible because of the work of all the NMDOH Data Stewards |
---|
66 | who maintain our health datasets, the NMDOH Indicator Report Authors and |
---|
67 | Editors who create and maintain the NM-IBIS indicator reports on which |
---|
68 | this report is based, and the people of New Mexico who support their efforts. |
---|
69 | </div> |
---|
70 | </xsl:template> |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | <xsl:template match="ibis:Page.demographicIndicators" mode="ibis.copy"> |
---|
75 | <table class="Info" title="table of demographics for this community"> |
---|
76 | <thead><tr> |
---|
77 | <th>Demographics</th> |
---|
78 | <th class="Value"><xsl:value-of select="$Page.communityTitle"/></th> |
---|
79 | <th class="Value"><xsl:value-of select="$Page.stateTitle"/></th> |
---|
80 | <th class="Value">U.S.</th> |
---|
81 | </tr></thead> |
---|
82 | |
---|
83 | <xsl:for-each select="$Page.demographicPublishedIndicators"> |
---|
84 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
85 | <xsl:sort select="NAME" data-type="text" order="ascending"/> |
---|
86 | |
---|
87 | <xsl:variable name="indicator" select="document(concat($Page.indicatorProfileXMLFilePath, NAME, '.xml'), /)/INDICATOR"/> |
---|
88 | <xsl:variable name="indicatorComparisonValues"> |
---|
89 | <xsl:call-template name="ComparisonValues.getIndicatorStateUSComparisonValues"> |
---|
90 | <xsl:with-param name="indicator" select="$indicator"/> |
---|
91 | <xsl:with-param name="dimensions" select="$Page.dimensions"/> |
---|
92 | <xsl:with-param name="measures" select="$Page.measures"/> |
---|
93 | <xsl:with-param name="valueTypes" select="$Page.valueTypes"/> |
---|
94 | <xsl:with-param name="communityDimensionName" select="$Page.dimensionName"/> |
---|
95 | <xsl:with-param name="communityDimensionValue" select="$Page.dimensionValue"/> |
---|
96 | </xsl:call-template> |
---|
97 | </xsl:variable> |
---|
98 | |
---|
99 | <tr class="Value"> |
---|
100 | <th><a href="{ibis:getRequestURL(concat('indicator/summary/', $indicator/NAME, '.html'))}"> |
---|
101 | <xsl:value-of select="ibis:getIndicatorTitle($indicator)"/> (<xsl:value-of select="$indicatorComparisonValues/PERIOD_DIMENSION/VALUE/TITLE"/>) |
---|
102 | </a> </th> |
---|
103 | <td><xsl:value-of select="$indicatorComparisonValues/COMMUNITY/VALUE/TITLE"/></td> |
---|
104 | <td><xsl:value-of select="$indicatorComparisonValues/STATE/VALUE/TITLE"/></td> |
---|
105 | <td><xsl:value-of select="$indicatorComparisonValues/US/VALUE/TITLE"/></td> |
---|
106 | </tr> |
---|
107 | </xsl:for-each> |
---|
108 | </table> |
---|
109 | </xsl:template> |
---|
110 | |
---|
111 | |
---|
112 | |
---|
113 | <!-- could also do param values as attribute @chartName --> |
---|
114 | <xsl:template match="ibis:Page.indicatorsChart" mode="ibis.copy"> |
---|
115 | <xsl:param name="chartName" select="CHART_NAME"/> |
---|
116 | <xsl:param name="measureName" select="MEASURE_NAME"/> |
---|
117 | <xsl:param name="indicatorSetName" select="INDICATOR_SET_NAME"/> |
---|
118 | |
---|
119 | <xsl:apply-templates select="HEADER_CONTENT/*" mode="ibis.copy"/> |
---|
120 | <div class="DataViz"> |
---|
121 | <h3><xsl:value-of select="TITLE"/></h3> |
---|
122 | <div id="{DATAVIZ_ID}" class="{DATAVIZ_CLASSES}"> |
---|
123 | </div> |
---|
124 | </div> |
---|
125 | <xsl:apply-templates select="FOOTER_CONTENT/*" mode="ibis.copy"/> |
---|
126 | |
---|
127 | |
---|
128 | <xsl:variable name="indicatorSet" select="document( ibis:getContentPath('xml/indicator/indicator_sets.xml'), /)//INDICATOR_SET[NAME = $Page.indicatorSetName]"/> |
---|
129 | <xsl:variable name="values"> |
---|
130 | <xsl:for-each select="$indicatorSet/INDICATOR_TO_INDICATOR_SETS/INDICATOR_TO_INDICATOR_SET/INDICATOR_NAME"> |
---|
131 | <xsl:sort select="SORT_ORDER" data-type="number" order="ascending"/> |
---|
132 | <xsl:sort select="INDICATOR_NAME" data-type="text" order="ascending"/> |
---|
133 | |
---|
134 | <xsl:call-template name="indicatorProfileRow"> |
---|
135 | <xsl:with-param name="indicatorName" select="current()"/> |
---|
136 | <xsl:with-param name="measureName" select="/HTML_CONTENT/PARAMETERS/PARAMETER[NAME='MeasureName']/VALUE"/> |
---|
137 | </xsl:call-template> |
---|
138 | </xsl:for-each> |
---|
139 | </xsl:variable> |
---|
140 | |
---|
141 | <xsl:variable name="communityCSV"> |
---|
142 | <xsl:for-each select="$values/INDICATOR_RECORD/COMMUNITY/VALUE/text()"> |
---|
143 | <xsl:if test="position() != 1">, </xsl:if> |
---|
144 | <xsl:value-of select="."/> |
---|
145 | </xsl:for-each> |
---|
146 | </xsl:variable> |
---|
147 | <xsl:variable name="stateCSV"> |
---|
148 | <xsl:for-each select="$values/INDICATOR_RECORD/STATE/VALUE/text()"> |
---|
149 | <xsl:if test="position() != 1">, </xsl:if> |
---|
150 | <xsl:value-of select="."/> |
---|
151 | </xsl:for-each> |
---|
152 | </xsl:variable> |
---|
153 | <xsl:variable name="usCSV"> |
---|
154 | <xsl:for-each select="$values/INDICATOR_RECORD/US/VALUE/text()"> |
---|
155 | <xsl:if test="position() != 1">, </xsl:if> |
---|
156 | <xsl:value-of select="."/> |
---|
157 | </xsl:for-each> |
---|
158 | </xsl:variable> |
---|
159 | |
---|
160 | <xsl:variable name="indicatorTitleCSV"> |
---|
161 | <xsl:for-each select="$values/INDICATOR_RECORD/TITLE"> |
---|
162 | <xsl:if test="position() != 1">, </xsl:if> |
---|
163 | "<xsl:value-of select="."/>" |
---|
164 | </xsl:for-each> |
---|
165 | </xsl:variable> |
---|
166 | |
---|
167 | <script> |
---|
168 | var kendoChartConstructorJSON = $.extend(true |
---|
169 | ,{} |
---|
170 | ,<xsl:call-template name="Kendo.namedConfigurationJSON"> |
---|
171 | <xsl:with-param name="configurationName" select="/HTML_CONTENT/PARAMETERS/PARAMETER[NAME='ChartName']/VALUE"/> |
---|
172 | </xsl:call-template> |
---|
173 | ,{ |
---|
174 | "title": |
---|
175 | { |
---|
176 | "text": "<xsl:value-of select="$indicatorSet/TITLE"/>" |
---|
177 | } |
---|
178 | ,"series": |
---|
179 | [ |
---|
180 | { |
---|
181 | "name": "<xsl:value-of select="distinct-values($values/INDICATOR_RECORD/COMMUNITY/TITLE)"/>" |
---|
182 | ,"data": [<xsl:value-of select="$communityCSV"/>] |
---|
183 | } |
---|
184 | ,{ |
---|
185 | "name": "<xsl:value-of select="distinct-values($values/INDICATOR_RECORD/STATE/TITLE)"/>" |
---|
186 | ,"data": [<xsl:value-of select="$stateCSV"/>] |
---|
187 | } |
---|
188 | ,{ |
---|
189 | "name": "<xsl:value-of select="distinct-values($values/INDICATOR_RECORD/US/TITLE)"/>" |
---|
190 | ,"data": [<xsl:value-of select="$usCSV"/>] |
---|
191 | } |
---|
192 | ] |
---|
193 | ,"valueAxis": |
---|
194 | { |
---|
195 | "title": {"text": "<xsl:value-of select="$values/INDICATOR_RECORD[1]/MEASURE/TITLE"/>"} |
---|
196 | } |
---|
197 | ,"categoryAxis": |
---|
198 | { |
---|
199 | "categories": [<xsl:value-of select="$indicatorTitleCSV"/>] |
---|
200 | } |
---|
201 | } |
---|
202 | ); |
---|
203 | |
---|
204 | $(document).ready( |
---|
205 | function() |
---|
206 | { |
---|
207 | console.log(kendoChartConstructorJSON); |
---|
208 | $("#chart").kendoChart(kendoChartConstructorJSON); |
---|
209 | } |
---|
210 | ); |
---|
211 | </script> |
---|
212 | |
---|
213 | </xsl:template> |
---|
214 | |
---|
215 | |
---|
216 | |
---|
217 | <xsl:template name="indicatorProfileRow" |
---|
218 | ibis:doc="Handles the xml/community/DIMENSION.xml type file. Which is of |
---|
219 | the struct: COMMUNITY_PROFILE, OVERVIEWS, DIMENSION, INDICATOR_PROFILES |
---|
220 | /INDICATOR_PROFILE/COMPARATIVE_VALUES/COMPARATIVE_VALUE/ TYPE, SERIES, |
---|
221 | CAT. |
---|
222 | " |
---|
223 | > |
---|
224 | <xsl:param name="indicatorName"/> |
---|
225 | <xsl:param name="indicator" select="document(concat($Page.indicatorProfileXMLFilePath, $indicatorName, '.xml'), /)/INDICATOR"/> |
---|
226 | <xsl:param name="measureName"/> |
---|
227 | |
---|
228 | <xsl:if test="not($indicator/*)"><xsl:message select="concat('IP NOT FOUND: ', $indicatorName)"/></xsl:if> |
---|
229 | <xsl:if test="$indicator/*"> |
---|
230 | <xsl:variable name="indicatorComparisonValues"> |
---|
231 | <xsl:call-template name="ComparisonValues.getIndicatorStateUSComparisonValues"> |
---|
232 | <xsl:with-param name="indicator" select="$indicator"/> |
---|
233 | <xsl:with-param name="communityDimensionName" select="$Page.dimensionName"/> |
---|
234 | <xsl:with-param name="communityDimensionValue" select="$Page.dimensionValue"/> |
---|
235 | <xsl:with-param name="measureName"/> |
---|
236 | <xsl:with-param name="dimensions" select="$Page.dimensions"/> |
---|
237 | <xsl:with-param name="measures" select="$Page.measures"/> |
---|
238 | <xsl:with-param name="valueTypes" select="$Page.valueTypes"/> |
---|
239 | </xsl:call-template> |
---|
240 | </xsl:variable> |
---|
241 | |
---|
242 | <xsl:if test="$indicatorComparisonValues/*"> |
---|
243 | <INDICATOR_RECORD> |
---|
244 | <xsl:copy-of select="$indicator/TITLE"/> |
---|
245 | <xsl:copy-of select="$indicatorComparisonValues"/> |
---|
246 | </INDICATOR_RECORD> |
---|
247 | </xsl:if> |
---|
248 | </xsl:if> |
---|
249 | </xsl:template> |
---|
250 | |
---|
251 | </xsl:stylesheet> |
---|
252 | <!-- ============================= End of File ============================= --> |
---|