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

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

view - Split out IP paths so that IP xml can be refed diff from standard xml content. Stubbed out ContentOptions? for IP, CP, and rough query bulder and result page options. css tweaks - buttons, user. Removed unused vert menu css from main css. Added more defensive code for ibis ip view title/dim value title. Removed all the contextNavigation from xslt code.

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