source: main/trunk/ibisph-view/src/main/webapp/xslt/xml/query/module/ConfigurationIncludeCriteriaExclude.xslt @ 20976

Last change on this file since 20976 was 20976, checked in by GarthBraithwaite_STG, 2 months ago

view - TEMP ibis:include commit to capture include processing tries. Secure query SS to set the related base path.

File size: 8.8 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:ibis="http://www.ibisph.org"
6
7        exclude-result-prefixes="ibis"
8>
9        <xsl:import href="../../../ibis.xslt"/>
10
11
12        <ibis:doc>
13                <name>xslt/xml/query/module/ConfigurationIncludeCriteriaExclude</name>
14                <summary>Provides query module XML specific "include" templates</summary>
15                <description>
16                        Provides a simple specialized query module 'ibis:include' that includes
17                        everything EXCEPT non selected configuration elements (e.g. NAME not
18                        equal to the 'ConfigurationName' parameter).  A blank matching technique
19                        was employed to deal with excluded SECTION, and DIMENSIONs.
20                </description>
21        </ibis:doc>
22
23
24        <xsl:param name="ConfigurationName" 
25                ibis:doc="Query module configuration name specified by the user and
26                        passed into the transformation via the Java servlet controller."
27        />
28        <xsl:param name="configuration"
29                ibis:doc="Configuration elements based on the ConfigurationName parameter
30                        passed to the XSLT via the controller.  This is implemented as an
31                        apply-templates so that any includes within the CONFIGURATION are
32                        processed.  Otherwise a simple variable with select would have worked
33                        much easier/more simply.  Note that the SkipVariable mode is needed
34                        if the CONFIGURATION element is selected because of the associated
35                        ibis.copy match CONFIGURATION template defined below.  Since this
36                        processes sub elements it is not needed.  For the SkipVariable version
37                        see repository prior to Feb 2008.
38                "
39        >
40                <xsl:apply-templates select="/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION[NAME = $ConfigurationName]/*" mode="ibis.copy"/>
41        </xsl:param>
42
43
44        <xsl:template match="/" ibis:doc="Main root match template that simply kicks things off by doing an 'apply-template'.">
45                <xsl:apply-templates mode="ibis.copy"/>
46        </xsl:template>
47
48
49        <xsl:template match="/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION[NAME != $ConfigurationName]" mode="ibis.copy"
50                ibis:doc="Configuration match template that simply eats the non matching
51                        CONFIGURATION elements.  See prior 7/27/2018 versions that was
52                        implemented differently using a parameter.  At some point might want
53                        to have UI selection to get alternate configs.  In this case can
54                        uncomment the code below and/or add addiontal fields etc.
55                "
56        >
57<!--
58        <CONFIGURATION>
59                <xsl:copy-of select="NAME" copy-namespaces="no"/>
60                <xsl:copy-of select="TITLE" copy-namespaces="no"/>
61                <xsl:copy-of select="MEASURE_NAME" copy-namespaces="no"/>
62        </CONFIGURATION>
63-->
64        </xsl:template>
65
66
67<!-- Could use this to hook and do config includes for DS, DIMs etc.
68
69        <xsl:template match="/QUERY_MODULE/CONFIGURATIONS/CONFIGURATION[NAME = $ConfigurationName]" mode="ibis.copy"
70                ibis:doc="used to include the AV definitions, VT, VA, possibly DIMs?
71                "
72        >
73                <xsl:message select="concat('QM XSLT - CONFIG NAME: ', $ConfigurationName)"/>
74                <xsl:message select="self::*"/>
75<xsl:copy>
76                <xsl:apply-templates mode="ibis.copy"/>
77</xsl:copy>
78        </xsl:template>
79-->
80
81
82
83        <xsl:template match="SECTION[NAME = $configuration/CRITERIA/EXCLUDE/SECTION_NAMES/SECTION_NAME]" mode="ibis.copy"
84                ibis:doc="Eat the SECTION element if in configuration criteria exclusion.
85                        NOTE: have to have names generic because if 'included' they won't have
86                        the full path!!!  Future need to be aware of potential conflicts if
87                        any SECTION type structure is added that is NOT related to the CRITERIA
88                        element as it could be excluded if the NAME matches.
89                "
90        />
91
92
93        <xsl:template match="DIMENSION[NAME = $configuration/CRITERIA/EXCLUDE/DIMENSION_NAMES/DIMENSION_NAME]" mode="ibis.copy"
94                ibis:doc="Eat the SECTION element if in configuration criteria exclusions.
95                        NOTE: have to have names generic because if 'included' they won't have
96                        the full path!!!  Future need to be aware of potential conflicts if
97                        any SECTION type structure is added that is NOT related to the
98                        DIMENSION element as it could be excluded if the NAME matches.
99                        NOTE #2: If a dimension is needed in the module and it is not to be
100                        displayed as a group by option then this dimension needs to have a
101                        dummy proxy dimension name set.
102                "
103        />
104
105
106        <xsl:template match="ibis:include[boolean(@configuration-name-list)]" mode="#all"
107                ibis:doc="
108                        Provides the ability to limit includes to a given configuration name(s)
109                        via a delimited list of names.  The list can be space and/or comma
110                        and or line break separated list of configuration names. 
111
112                        If the name matches the Java injected QM config name then this
113                        template recreates a similar ibis:include sans the configuration-name-list
114                        and calls apply templates so that the standard ibis:include code is
115                        applied.  See the ibis:include function for more info. 
116                "
117        >
118                <xsl:variable name="configurationNames" select="tokenize(normalize-space(replace(@configuration-name-list, ',', ' ')), '\s+')"/>
119                <xsl:if test="$configurationNames = $ConfigurationName">
120                        <xsl:variable name="url" select="if(0 != string-length(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/>
121                        <xsl:choose>
122                                <xsl:when test="exists(@child-name-list)">
123                                        <xsl:variable name="names"       select="tokenize(normalize-space(replace(@child-name-list, ',', ' ')), '\s+')"/>
124                                        <xsl:variable name="rootElement" select="document($url)/*"/>
125                                        <xsl:for-each select="$names">
126                                                <xsl:apply-templates select="$rootElement/*[NAME=current()]" mode="ibis.copy"/>
127                                        </xsl:for-each>
128                                </xsl:when>
129                                <xsl:when test="exists(@children-only-flag)">
130                                        <xsl:apply-templates select="document($url, /)/(*/text() | */*)" mode="ibis.copy"/>
131                                </xsl:when>
132                                <xsl:otherwise>
133                                        <xsl:apply-templates select="document($url, /)/*" mode="ibis.copy"/>
134                                </xsl:otherwise>
135                        </xsl:choose>
136                </xsl:if>
137        </xsl:template>
138
139
140
141<!--
142UNSUCCESSFUL TRIES:
143
144<xsl:variable name="ibisIncludeElement">
145                                <xsl:element name="ibis:include">
146                                        <xsl:attribute name="href"><xsl:value-of select="if(exists(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/></xsl:attribute>
147                                        <xsl:if test="0 != string-length(@child-name-list)"><xsl:attribute name="child-name-list"><xsl:value-of select="@child-name-list"/></xsl:attribute></xsl:if>
148                                        <xsl:if test="0 != string-length(@children-only-flag)"><xsl:attribute name="children-only-flag"><xsl:value-of select="@children-only-flag"/></xsl:attribute></xsl:if>
149                                </xsl:element>
150                        </xsl:variable>
151<xsl:message select="$ibisIncludeElement"/>
152
153                        <xsl:apply-templates select="$ibisIncludeElement" mode="ibis.copy"/>
154
155
156<xsl:attribute-set name="font">
157  <xsl:attribute name="fname">Arial</xsl:attribute>
158  <xsl:attribute name="size">14px</xsl:attribute>
159  <xsl:attribute name="color">red</xsl:attribute>
160</xsl:attribute-set>
161
162<xsl:element
163  name="element-name"
164  namespace="URI"
165  use-attribute-sets="qname"
166>
167</xsl:element>
168
169<xsl:variable name="ibisIncludeElement">
170                        <xsl:copy-of select=". | @* except @configuration-name-list"/>
171</xsl:variable>
172
173<xsl:variable name="ibisIncludeElement" select="@* except @configuration-name-list | *"/>
174
175                        <xsl:apply-templates select="$ibisIncludeElement" mode="ibis.copy"/>
176
177
178<xsl:variable name="ibisIncludeElement">
179                                <xsl:element name="ibis:include" >
180                                        <xsl:attribute name="href"><xsl:value-of select="if(exists(@use-prefix)) then concat($ibis.baseRequestPath, @href) else @href"/></xsl:attribute>
181                                        <xsl:if test="0 != string-length(@child-name-list)"><xsl:attribute name="child-name-list"><xsl:value-of select="@child-name-list"/></xsl:attribute></xsl:if>
182                                        <xsl:if test="0 != string-length(@children-only-flag)"><xsl:attribute name="children-only-flag"><xsl:value-of select="@children-only-flag"/></xsl:attribute></xsl:if>
183                                </xsl:element>
184                        </xsl:variable>
185
186                        <xsl:apply-templates select="$ibisIncludeElement" mode="ibis.copy"/>
187
188                        <xsl:apply-templates select="node()  | @* except @configuration-name-list"/>
189
190
191<xsl:message select="$ConfigurationName"/>
192<xsl:message select="node() | @* except @configuration-name-list"/>
193                        <xsl:apply-templates select="node() | (@* except @configuration-name-list)"  mode="ibis.copy"/>
194
195                        <xsl:variable name="rootElement" select="document(@href)/*">
196                                <xsl:if test="0 != string-length(@child-name-list)"><xsl:attribute name="child-name-list"><xsl:value-of select="@child-name-list"/></xsl:attribute></xsl:if>
197                                <xsl:if test="0 != string-length(@children-only-flag)"><xsl:attribute name="children-only-flag"><xsl:value-of select="@children-only-flag"/></xsl:attribute></xsl:if>
198                        </xsl:variable>
199                        <xsl:apply-templates select="$rootElement" mode="ibis.copy"/>
200
201<xsl:message select="$ConfigurationName"/>
202                        <xsl:apply-templates select="node() | (@* except @configuration-name-list)" mode="ibis.copy"/>
203-->
204
205
206</xsl:stylesheet>
207<!-- ============================= End of File ============================= -->
Note: See TracBrowser for help on using the repository browser.