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="Page.xslt"/> |
---|
10 | <xsl:import href="SiteSpecific.xslt"/> |
---|
11 | |
---|
12 | |
---|
13 | <ibis:doc> |
---|
14 | <name>html/HTMLContentPage</name> |
---|
15 | <summary>Core templates that handle the 'HTML_CONTENT' XML elements to |
---|
16 | produce an IBIS-PH HTML page. |
---|
17 | </summary> |
---|
18 | <description> |
---|
19 | Base XSLT that provides the templates to transform 'HTML_CONTENT' type |
---|
20 | XML content to IBISPH-View HTML pages. This template and the 'HTML_CONTENT' |
---|
21 | XML data files form a simple mechanism to help keep all static type pages |
---|
22 | more easily maintained and consistent. This framework provides the |
---|
23 | advantages of server side includes (SSI) while providing some extra |
---|
24 | value like being able to reference resources using a relative path. |
---|
25 | <br/><br/> |
---|
26 | |
---|
27 | URL NOTE: This template contains a special way to handle IBIS type URLs. |
---|
28 | Instead of hard coding the link to include the application context and |
---|
29 | path, a relative type path can be used with an "ibis:" namespace. This |
---|
30 | causes the web app context prefix to be added to the resource path so |
---|
31 | that the path is free of context deployment paths. If the link is within |
---|
32 | the same 'folder' (as defined in with the resource mapping), then the |
---|
33 | 'ibis:' is not needed. However, if it is NOT, then it should be used. |
---|
34 | An example is the 'about/content_usage.html' page referencing a graphic |
---|
35 | image 'image/OH.gif'. If the link is coded using relative addressing |
---|
36 | and the system is deployed to the webapp context of 'ibisph-view' then |
---|
37 | this link will not work because the server will look for the image with |
---|
38 | a path of: 'ibisph-view/about/image/DOH.gif'. To work, the link would |
---|
39 | have to be coded as '/ibisph-view/image/DOH.gif' but what happens if this |
---|
40 | save system is deployed as the root application. Then the link would |
---|
41 | have to be coded as '/image/DOH.gif' etc. The processing of the link |
---|
42 | by this template automatically adds the appropriate webapp content prefix |
---|
43 | so that the resources can be relatively addressed. Of couse if a relative |
---|
44 | address is really wanted then simply skip placing the 'ibis:' namespace |
---|
45 | prefix to the link's attribute. |
---|
46 | </description> |
---|
47 | </ibis:doc> |
---|
48 | |
---|
49 | |
---|
50 | <!-- ~~~~~~~~~~~~~~~~~~~~~~~ PARAMS / VARIABLES ~~~~~~~~~~~~~~~~~~~~~~~~ --> |
---|
51 | <xsl:param name="Page.pageTitle" select="HTML_CONTENT/TITLE" |
---|
52 | ibis:doc="HTML API template implementation that provides the HTML page's title text." |
---|
53 | /> |
---|
54 | <xsl:param name="Page.metaDescription" select="HTML_CONTENT/DESCRIPTION" |
---|
55 | ibis:doc="HTML API template implementation that provides the HTML page's 'description' meta tag text. Defaults to the 'HTML_CONTENT/DESCRIPTION' element." |
---|
56 | /> |
---|
57 | <xsl:param name="Page.metaKeywords" select="HTML_CONTENT/KEYWORDS" |
---|
58 | ibis:doc="HTML API template implementation that provides the HTML page's 'keyword' meta tag text. Defaults to the 'HTML_CONTENT/KEYWORDS' element." |
---|
59 | /> |
---|
60 | <xsl:param name="Page.htmlClass" select="HTML_CONTENT/HTML_CLASS" |
---|
61 | ibis:doc="ability to specify the main html css class." |
---|
62 | /> |
---|
63 | |
---|
64 | |
---|
65 | <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEMPLATES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> |
---|
66 | <xsl:template name="Page.specificHeadContent" |
---|
67 | ibis:doc="HTML API template implementation that provides the ability to specify other HTML HEAD tag content. Defaults to the 'HTML_CONTENT/OTHER_HEAD_CONTENT' element."> |
---|
68 | <xsl:apply-templates select="HTML_CONTENT/OTHER_HEAD_CONTENT/* | HTML_CONTENT/OTHER_HEAD_CONTENT/text() | HTML_CONTENT/OTHER_HEAD_CONTENT/@*" mode="ibis.copy"/> |
---|
69 | </xsl:template> |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | <xsl:template name="Page.contentBody" ibis:doc="HTML API template implementation |
---|
74 | that provides main HTML body content for the page. Defaults to copying |
---|
75 | all elements and attributes of the the 'HTML_CONTENT/CONTENT' element." |
---|
76 | > |
---|
77 | <!-- used an apply templates so that the ibis: stuff would be handled --> |
---|
78 | <xsl:apply-templates select="HTML_CONTENT/CONTENT/(text() | *)" mode="ibis.copy"/> |
---|
79 | </xsl:template> |
---|
80 | |
---|
81 | |
---|
82 | <xsl:template match="ibis:include" |
---|
83 | ibis:doc="Provides include processing." |
---|
84 | > |
---|
85 | <xsl:apply-templates select= |
---|
86 | "if(exists(@children-only-flag)) |
---|
87 | then document(@href, /)/(text() | *) |
---|
88 | else document(@href, /) |
---|
89 | " |
---|
90 | mode="ibis.copy" |
---|
91 | /> |
---|
92 | </xsl:template> |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | <xsl:template match="ibis:ContentBlock" mode="ibis.copy" |
---|
97 | ibis:doc="Provides ability to more easily embed a fixed content block |
---|
98 | into the page's content. |
---|
99 | " |
---|
100 | > |
---|
101 | <xsl:call-template name="ContentContainer.contentBlock"> |
---|
102 | <xsl:with-param name="containerID" select="if(0 != string-length(@id)) then @id else NAME"/> |
---|
103 | <xsl:with-param name="contentContainerClass" select="@contentContainerClass"/> |
---|
104 | <xsl:with-param name="additionalClasses" select="@additionalClasses"/> |
---|
105 | <xsl:with-param name="title" select="TITLE"/> |
---|
106 | <xsl:with-param name="titleLevel" select="if(exists(@titleLevel)) then @titleLevel else 3"/> |
---|
107 | <xsl:with-param name="description" select="DESCRIPTION"/> |
---|
108 | <xsl:with-param name="content" select="CONTENT"/> |
---|
109 | <xsl:with-param name="contentBlockType" select="if(0 != string-length(@contentBlockType)) then @contentBlockType else $ContentContainer.defaultContentBlockType"/> |
---|
110 | <xsl:with-param name="expandableControlType" select="if(0 != string-length(@expandableControlType)) then @expandableControlType else $ContentContainer.expandableControlType"/> |
---|
111 | <xsl:with-param name="expandableContentShow" select="if(0 != string-length(@expandableContentShow)) then @expandableContentShow else SHOW"/> |
---|
112 | <xsl:with-param name="expandableControlName" select="if(0 != string-length(@expandableControlName)) then @expandableControlName else $ContentContainer.expandableControlName"/> |
---|
113 | <xsl:with-param name="expandableControlAccesskey" select="@expandableControlAccesskey"/> |
---|
114 | <xsl:with-param name="addWikiAttribute" select="if(0 != string-length(@addWikiAttribute)) then @addWikiAttribute else $ContentContainer.addWikiAttributeToContentContainer"/> |
---|
115 | </xsl:call-template> |
---|
116 | </xsl:template> |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | <xsl:template match="ibis:ExpandableContent" mode="ibis.copy" |
---|
121 | ibis:doc="Provides ability to more easily embed an expandable content block |
---|
122 | into the page's content. Note that the approp CSS will need to be included. |
---|
123 | The control and container require an 'id' attribute. This ID uses the |
---|
124 | optional NAME sub element. If NAME doesn't exist then postion() is used. |
---|
125 | This will create unique ID's in most cases. The CONTENT text() and |
---|
126 | sub elements will be ibis:copied into the assoc content container DIV. |
---|
127 | |
---|
128 | Dropdown content are is just as easily coded directly in the CONTENT |
---|
129 | so no template call/special processing is implemented as it just gets |
---|
130 | in the way. |
---|
131 | " |
---|
132 | > |
---|
133 | <xsl:call-template name="ContentContainer.expandable"> |
---|
134 | <xsl:with-param name="controlID" select="@id"/> |
---|
135 | <xsl:with-param name="controlType" select="@controlType"/> |
---|
136 | <xsl:with-param name="additionalClasses" select="@additionalClasses"/> |
---|
137 | <xsl:with-param name="controlName" select=" |
---|
138 | if(not(@controlName)) then NAME |
---|
139 | else @controlName |
---|
140 | "/> |
---|
141 | <xsl:with-param name="title" select="TITLE"/> |
---|
142 | <xsl:with-param name="titleLevel" select="if(exists(@titleLevel)) then @titleLevel else 2"/> |
---|
143 | <xsl:with-param name="description" select="DESCRIPTION"/> |
---|
144 | <xsl:with-param name="content" select="CONTENT"/> |
---|
145 | <xsl:with-param name="show" select="exists(SHOW) or (string-length(@show) != 0)"/> |
---|
146 | </xsl:call-template> |
---|
147 | </xsl:template> |
---|
148 | |
---|
149 | |
---|
150 | |
---|
151 | <xsl:template match="ibis:SelectionsList" mode="ibis.copy" |
---|
152 | ibis:doc="Provides ability to more easily create a list structure based |
---|
153 | on the standard SELECTIONS/SELECTION structure. The controlType and |
---|
154 | class controls indentured/expandable behavior. Note that the approp |
---|
155 | CSS will need to be included. This code handles sub ibis:includes |
---|
156 | so that a MENU structure can be included. If the container element |
---|
157 | does NOT have a direct child element named SELECTIONS then the optional |
---|
158 | SELECTIONS_CONTAINER_ELEMENT_NAME can be used. If the INCLUDE_SUB_LISTS |
---|
159 | element is present then the list will be processed for sub lists. |
---|
160 | " |
---|
161 | > |
---|
162 | <!-- variable is needed to process any ibis:include statements --> |
---|
163 | <xsl:param name="ibisIncludeProcessedContent"> |
---|
164 | <xsl:apply-templates select="*" mode="ibis.copy"/> |
---|
165 | </xsl:param> |
---|
166 | <xsl:param name="selections" |
---|
167 | select=" |
---|
168 | if(exists(SELECTIONS_CONTAINER_ELEMENT_NAME)) |
---|
169 | then $ibisIncludeProcessedContent//*[name()=$ibisIncludeProcessedContent/SELECTIONS_CONTAINER_ELEMENT_NAME]/* |
---|
170 | else $ibisIncludeProcessedContent |
---|
171 | " |
---|
172 | /> |
---|
173 | <xsl:call-template name="SelectionsList.processSelections"> |
---|
174 | <xsl:with-param name="containerID" select="@id"/> |
---|
175 | <xsl:with-param name="containerClass" select="@class"/> |
---|
176 | <xsl:with-param name="controlType" select="@controlType"/> |
---|
177 | <xsl:with-param name="selections" select="$selections"/> |
---|
178 | </xsl:call-template> |
---|
179 | </xsl:template> |
---|
180 | |
---|
181 | |
---|
182 | |
---|
183 | <xsl:template match="ibis:ContiditionalSection" mode="ibis.copy" |
---|
184 | ibis:doc="Provides ability include/exclude certain sections of HTML |
---|
185 | CONTENT. For this to work, an overriden callback type template |
---|
186 | is used. This template is passed the section's ID. The template |
---|
187 | must then determine if the section should be included. The template |
---|
188 | determines this by XML, the passed in ID, and any other parameters |
---|
189 | that have been passed into the transformer process. |
---|
190 | |
---|
191 | For working examples see repository for the user related XSLT and |
---|
192 | HTML_CONTENT ~May 2013. |
---|
193 | " |
---|
194 | > |
---|
195 | <xsl:param name="test"> |
---|
196 | <xsl:call-template name="HTMLContent.includeConditionalSection"> |
---|
197 | <xsl:with-param name="sectionID" select="@id"/> |
---|
198 | </xsl:call-template> |
---|
199 | </xsl:param> |
---|
200 | |
---|
201 | <xsl:if test="ibis:isFirstLetter_T_or_Y_or_X($test)"> |
---|
202 | <xsl:apply-templates select="(text() | *)" mode="ibis.copy"/> |
---|
203 | </xsl:if> |
---|
204 | </xsl:template> |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | <xsl:template name="HTMLContent.includeConditionalSection" |
---|
209 | ibis:doc="Callback type template that controls if the section should be |
---|
210 | processed. If the template returns 'T', 'X', or 'Y' then that |
---|
211 | content will be included. If nothing or 'F', 'N' then that cotent |
---|
212 | will be omitted. Default is to omit everything. Sub XSLTs must |
---|
213 | override this template and determine if the content should be shown |
---|
214 | based on the XML, params passed in, and the section's ID attribute. |
---|
215 | " |
---|
216 | > |
---|
217 | <xsl:param name="sectionID"/> |
---|
218 | </xsl:template> |
---|
219 | |
---|
220 | |
---|
221 | |
---|
222 | <xsl:template match="ibis:help" mode="ibis.copy" |
---|
223 | ibis:doc="Provides a help button/popup." |
---|
224 | > |
---|
225 | <xsl:call-template name="Help.content"> |
---|
226 | <xsl:with-param name="help" select="."/> |
---|
227 | </xsl:call-template> |
---|
228 | </xsl:template> |
---|
229 | |
---|
230 | </xsl:stylesheet> |
---|
231 | <!-- ============================= End of File ============================= --> |
---|
232 | |
---|