source: main/trunk/ibisph-view/src/main/webapp/xslt/_ibis-title.xslt @ 22751

Last change on this file since 22751 was 21328, checked in by GarthBraithwaite_STG, 14 months ago

view - added quick and dirty apply criteria table to the qm result.

File size: 7.3 KB
Line 
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:xs  ="http://www.w3.org/2001/XMLSchema"
6        xmlns:ibis="http://www.ibisph.org"
7
8        exclude-result-prefixes="ibis xs xsl"
9>
10
11        <ibis:doc>
12                <name>ibis.title</name>
13                <summary>Library of generic/common ibis title related functions</summary>
14        </ibis:doc>
15
16
17        <!-- ========================= P A R A M E T E R S   and   V A R I A B L E S
18                The java servlet controller code adds ALL URL query request parameters
19                to the XSLT transformation's parameters.  Other special parameters are
20                added as well. 
21
22                Many of the global type parameters are defined within this XSLT file. 
23                The parameters are passed in via the Java XSLT transformation parameter
24                map (and thus are nameed according to the Java model map key value). 
25                For ease of XSLT code maintenance these global XSLT parameters are
26                wrapped within an "ibis." prefix so that it is shown which XSLT file
27                contains the definition.
28        -->
29        <xsl:param name="ibis.adopterTitle" select="'State'"
30                ibis:doc="Value to be used when the XSLT code needs a title usage example
31                        is CP reports that compare community, state, and US.  This should be
32                        overridden in the main ss.xslt with values like 'Utah', 'New Mexico' etc.
33                "
34        />
35
36
37        <!-- ================================================= F U N C T I O N S -->
38        <xsl:function name="ibis:getDimensionTitle" as="xs:string" 
39                ibis:doc="localizes and hides the if LABEL else TITLE code."
40        >
41                <xsl:param name="dimension"/>
42                <xsl:value-of select="
43                        if(0 != string-length($dimension/LABEL))
44                        then $dimension/LABEL
45                        else $dimension/TITLE
46                "/>
47        </xsl:function>
48
49
50        <xsl:function name="ibis:getDimensionValueTitle" as="xs:string" 
51                ibis:doc="localizes and getting the value TITLE.  If no TITLE then simply returns the VALUE's text()."
52        >
53                <xsl:param name="dimensionValue"/>
54                <xsl:value-of select="if(0 != string-length($dimensionValue/TITLE)) then $dimensionValue/TITLE else $dimensionValue/text()[1]"/>
55        </xsl:function>
56
57
58        <xsl:function name="ibis:getIndicatorViewPeriodDimensionValuesTitle" as="xs:string"
59                ibis:doc="Builds single or range of period dimension values."
60        >
61                <xsl:param name="indicatorView" ibis:doc="Indicator Profile View to be used to get the dim values."/>
62                <xsl:param name="dimensions"    ibis:doc="actual dimensions."/>
63
64                <xsl:variable name="periodDimension" select="($dimensions/DIMENSION[NAME = $indicatorView/PERIOD_DIMENSION_NAME])[1]"/>
65                <xsl:variable name="indicatorViewDimensionUsageValues" select="$indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[NAME = $indicatorView/PERIOD_DIMENSION_NAME]/VALUES"/>
66
67                <xsl:variable name="firstDimensionUsageValue" select="normalize-space($indicatorViewDimensionUsageValues/VALUE[1]/text()[1])"/>
68                <xsl:variable name="lastDimensionUsageValue"  select="normalize-space($indicatorViewDimensionUsageValues/VALUE[last()]/text()[1])"/>
69
70                <xsl:variable name="firstDimensionValue" select="$periodDimension/VALUES/VALUE[normalize-space(text()[1]) = $firstDimensionUsageValue]"/>
71                <xsl:variable name="lastDimensionValue"  select="$periodDimension/VALUES/VALUE[normalize-space(text()[1]) = $lastDimensionUsageValue]"/>
72
73                <xsl:value-of select="if($firstDimensionUsageValue = $lastDimensionUsageValue)
74                        then ibis:getDimensionValueTitle($firstDimensionValue)
75                        else concat(
76                                ibis:getDimensionValueTitle($firstDimensionValue),
77                                ' to ',
78                                ibis:getDimensionValueTitle($lastDimensionValue)
79                        )"/>
80        </xsl:function>
81
82
83        <xsl:function name="ibis:getMapTitle" as="xs:string" 
84                ibis:doc="localizes the IP or QM config map TITLE.  If not found returns the name."
85        >
86                <xsl:param name="maps"    ibis:doc="MAPS element to be looked up."/>
87                <xsl:param name="mapName" ibis:doc="map name to be looked up."/>
88                <xsl:variable name="title" select="$maps/MAP[NAME = $mapName]/TITLE"/>
89                <xsl:value-of select="
90                        if(0 != string-length($title))
91                        then $title
92                        else $mapName
93                "/>
94        </xsl:function>
95
96        <xsl:function name="ibis:getChartTitle" as="xs:string" 
97                ibis:doc="localizes the IP or QM config chart TITLE.  If not found returns the name."
98        >
99                <xsl:param name="charts"    ibis:doc="CHARTS element to be looked up."/>
100                <xsl:param name="chartName" ibis:doc="chart name to be looked up."/>
101                <xsl:variable name="title" select="$charts/CHART[NAME = $chartName]/TITLE"/>
102                <xsl:value-of select="
103                        if(0 != string-length($title))
104                        then $title
105                        else $chartName
106                "/>
107        </xsl:function>
108
109        <xsl:function name="ibis:getMeasureTitle" as="xs:string" 
110                ibis:doc="localizes the IP or QM config MEASURE_TITLE_OVERRIDE else use measure TITLE."
111        >
112                <xsl:param name="measureTitleOverride" ibis:doc="If specified this title value is returned."/>
113                <xsl:param name="measure" ibis:doc="default measure title to use if no override value."/>
114                <xsl:value-of select="
115                        if(0 != string-length($measureTitleOverride))
116                        then $measureTitleOverride
117                        else $measure/TITLE
118                "/>
119        </xsl:function>
120
121
122        <xsl:function name="ibis:getIndicatorViewChartTitle" as="xs:string" 
123                ibis:doc="localizes and hides the if CHART_TITLE_OVERRIDE else built TITLE code."
124        >
125                <xsl:param name="indicatorView" ibis:doc="Indicator Profile needed for CHART_TITLE_OVERRIDE and complete IV title."/>
126                <xsl:param name="completeIndicatorViewTitle" ibis:doc="default title."/>
127                <xsl:value-of select="
128                        if(0 != string-length($indicatorView/CHART_TITLE_OVERRIDE))
129                        then $indicatorView/CHART_TITLE_OVERRIDE
130                        else $completeIndicatorViewTitle
131                "/>
132        </xsl:function>
133
134        <xsl:function name="ibis:getIndicatorViewMapTitle" as="xs:string" 
135                ibis:doc="localizes and hides the if MAP_TITLE_OVERRIDE else built TITLE code."
136        >
137                <xsl:param name="indicatorView" ibis:doc="Indicator Profile needed for MAP_TITLE_OVERRIDE and complete IV title."/>
138                <xsl:param name="completeIndicatorViewTitle" ibis:doc="default title."/>
139                <xsl:value-of select="
140                        if(0 != string-length($indicatorView/MAP_TITLE_OVERRIDE))
141                        then $indicatorView/MAP_TITLE_OVERRIDE
142                        else $completeIndicatorViewTitle
143                "/>
144        </xsl:function>
145
146        <xsl:function name="ibis:getIndicatorTitle" as="xs:string"
147                ibis:doc="Uses CONCISE_TITLE if present otherwise the main title."
148        >
149                <xsl:param name="indicator" ibis:doc="Indicator Profile to be used to get the title from."/>
150                <xsl:value-of select="
151                        if(0 != string-length(normalize-space($indicator/CONCISE_TITLE)))
152                        then $indicator/CONCISE_TITLE
153                        else $indicator/TITLE
154                "/>
155        </xsl:function>
156
157        <xsl:function name="ibis:getCompleteIndicatorViewTitle" as="xs:string"
158                ibis:doc="Builds a complete view title.  If view title is 'by' then prepend ' ', else '.' "
159        >
160                <xsl:param name="indicator"     ibis:doc="Indicator Profile needed for CONCISE_TITLE."/>
161                <xsl:param name="indicatorView" ibis:doc="Indicator Profile View to be used to build the title from."/>
162                <xsl:param name="dimensions"    ibis:doc="actual dimensions."/>
163
164                <xsl:variable name="delimiter" select="if(starts-with($indicatorView/TITLE, 'by'))then ' ' else '. '"/>
165                <xsl:value-of select="concat(
166                        ibis:getIndicatorTitle($indicator),
167                        $delimiter, $indicatorView/TITLE, ', ',
168                        ibis:getIndicatorViewPeriodDimensionValuesTitle($indicatorView, $dimensions))"
169                /> 
170        </xsl:function>
171
172</xsl:stylesheet>
173<!-- ============================= End of File ============================= -->
174
Note: See TracBrowser for help on using the repository browser.