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

Last change on this file since 18890 was 18890, checked in by GarthBraithwaite_STG, 6 weeks ago

db, view - IPV title xslt rules and data updates.

File size: 5.9 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        <xsl:function name="ibis:getDimensionValueTitle" as="xs:string" 
50                ibis:doc="localizes and getting the value TITLE."
51        >
52                <xsl:param name="dimension"/>
53                <xsl:param name="dimensionValue"/>
54
55                <xsl:value-of select="$dimension/VALUES/VALUE[normalize-space(text()[1]) = $dimensionValue]/TITLE"/>
56        </xsl:function>
57
58        <xsl:function name="ibis:getPeriodDimensionValuesTitle" 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="indicatorViewDimensionValues" select="$indicatorView/DIMENSION_USAGES/DIMENSION_USAGE[NAME = $indicatorView/PERIOD_DIMENSION_NAME]/VALUES"/>
66                <xsl:variable name="firstDimensionValue" select="$indicatorViewDimensionValues/VALUE[1]/text()"/>
67                <xsl:variable name="lastDimensionValue"  select="$indicatorViewDimensionValues/VALUE[last()]/text()"/>
68
69                <xsl:value-of select="if($firstDimensionValue = $lastDimensionValue)
70                        then ibis:getDimensionValueTitle($periodDimension, $firstDimensionValue)
71                        else concat(ibis:getDimensionValueTitle($periodDimension, $firstDimensionValue),
72                                ' to ',
73                                ibis:getDimensionValueTitle($periodDimension, $lastDimensionValue)
74                        )"/>
75        </xsl:function>
76
77
78        <xsl:function name="ibis:getIndicatorViewChartTitle" as="xs:string" 
79                ibis:doc="localizes and hides the if CHART_TITLE_OVERRIDE else built TITLE code."
80        >
81                <xsl:param name="indicator"     ibis:doc="Indicator Profile needed for complete IV title."/>
82                <xsl:param name="indicatorView" ibis:doc="Indicator Profile needed for CHART_TITLE_OVERRIDE and complete IV title."/>
83                <xsl:param name="dimensions"    ibis:doc="actual dimensions."/>
84                <xsl:value-of select="
85                        if(0 != string-length($indicatorView/CHART_TITLE_OVERRIDE))
86                        then $indicatorView/CHART_TITLE_OVERRIDE
87                        else ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $dimensions)
88                "/>
89        </xsl:function>
90
91        <xsl:function name="ibis:getIndicatorViewMapTitle" as="xs:string" 
92                ibis:doc="localizes and hides the if MAP_TITLE_OVERRIDE else built TITLE code."
93        >
94                <xsl:param name="indicator"     ibis:doc="Indicator Profile needed for complete IV title."/>
95                <xsl:param name="indicatorView" ibis:doc="Indicator Profile needed for MAP_TITLE_OVERRIDE and complete IV title."/>
96                <xsl:param name="dimensions"    ibis:doc="actual dimensions."/>
97                <xsl:value-of select="
98                        if(0 != string-length($indicatorView/MAP_TITLE_OVERRIDE))
99                        then $indicatorView/MAP_TITLE_OVERRIDE
100                        else ibis:getCompleteIndicatorViewTitle($indicator, $indicatorView, $dimensions)
101                "/>
102
103        </xsl:function>
104
105        <xsl:function name="ibis:getIndicatorTitle" as="xs:string"
106                ibis:doc="Uses CONCISE_TITLE if present otherwise the main title."
107        >
108                <xsl:param name="indicator" ibis:doc="Indicator Profile to be used to get the title from."/>
109                <xsl:value-of select="
110                        if(0 != string-length(normalize-space($indicator/CONCISE_TITLE)))
111                        then $indicator/CONCISE_TITLE
112                        else $indicator/TITLE
113                "/>
114        </xsl:function>
115
116        <xsl:function name="ibis:getCompleteIndicatorViewTitle" as="xs:string"
117                ibis:doc="Builds a complete view title."
118        >
119                <xsl:param name="indicator"     ibis:doc="Indicator Profile needed for CONCISE_TITLE."/>
120                <xsl:param name="indicatorView" ibis:doc="Indicator Profile View to be used to build the title from."/>
121                <xsl:param name="dimensions"    ibis:doc="actual dimensions."/>
122
123                <xsl:if test="starts-with($indicatorView/TITLE, 'by')">
124                        <xsl:value-of select="concat(ibis:getIndicatorTitle($indicator), ' ',
125                                $indicatorView/TITLE, ', ',
126                                ibis:getPeriodDimensionValuesTitle($indicatorView, $dimensions))"
127                        /> 
128                </xsl:if>
129                <xsl:if test="not(starts-with($indicatorView/TITLE, 'by'))">
130                        <xsl:value-of select="concat(ibis:getIndicatorTitle($indicator), '. ',
131                                $indicatorView/TITLE, ', ',
132                                ibis:getPeriodDimensionValuesTitle($indicatorView, $dimensions))"
133                        /> 
134                </xsl:if>
135        </xsl:function>
136
137</xsl:stylesheet>
138<!-- ============================= End of File ============================= -->
139
Note: See TracBrowser for help on using the repository browser.