1 <?xml version="1.0"?>
\r
3 <xsl:stylesheet version="1.0"
\r
4 xmlns:xhtml="http://www.w3.org/1999/xhtml"
\r
5 xmlns="http://www.w3.org/1999/xhtml"
\r
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
7 xmlns:xs="http://www.w3.org/2001/XMLSchema"
\r
8 xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
\r
9 xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"
\r
10 exclude-result-prefixes="xhtml xsl fn xs xdt">
\r
13 omit-xml-declaration="yes"
\r
15 doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
\r
16 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
\r
18 <xsl:attribute-set name="ricoTable">
\r
19 <xsl:attribute name="cellspacing">0</xsl:attribute>
\r
20 <xsl:attribute name="cellpadding">0</xsl:attribute>
\r
21 </xsl:attribute-set>
\r
23 <!-- the identity template -->
\r
25 <xsl:template match="*">
\r
27 <xsl:copy-of select="@*"/>
\r
28 <xsl:apply-templates/>
\r
33 <!-- Transform head section -->
\r
35 <xsl:template match="xhtml:head">
\r
37 <xsl:apply-templates mode="head"/>
\r
38 <script type="text/javascript">
\r
40 if (typeof ricoInit!='undefined') {
\r
41 if (window.addEventListener)
\r
42 window.addEventListener('load', ricoInit, false);
\r
43 else if (window.attachEvent)
\r
44 window.attachEvent('onload', ricoInit);
\r
51 <xsl:template match="*[name()!='script']" mode="head">
\r
53 <xsl:copy-of select="@*|node()"/>
\r
57 <xsl:template match="xhtml:script" mode="head">
\r
59 <xsl:copy-of select="@*"/>
\r
60 <xsl:value-of select="." disable-output-escaping="yes"/>
\r
65 <!-- Transform tables with class ricoSimpleGrid -->
\r
67 <xsl:template match="xhtml:table[@class='ricoSimpleGrid']">
\r
70 <xsl:when test="xhtml:thead">
\r
71 <xsl:call-template name="processTable">
\r
72 <xsl:with-param name="id" select="@id"/>
\r
73 <xsl:with-param name="headRows" select="xhtml:thead/xhtml:tr"/>
\r
74 <xsl:with-param name="bodyRows" select="xhtml:tbody/xhtml:tr"/>
\r
75 </xsl:call-template>
\r
78 <xsl:when test="xhtml:tbody">
\r
79 <xsl:call-template name="processTable">
\r
80 <xsl:with-param name="id" select="@id"/>
\r
81 <xsl:with-param name="headRows" select="xhtml:tbody/xhtml:tr[1]"/>
\r
82 <xsl:with-param name="bodyRows" select="xhtml:tbody/xhtml:tr[position() > 1]"/>
\r
83 </xsl:call-template>
\r
87 <xsl:call-template name="processTable">
\r
88 <xsl:with-param name="id" select="@id"/>
\r
89 <xsl:with-param name="headRows" select="xhtml:tr[1]"/>
\r
90 <xsl:with-param name="bodyRows" select="xhtml:tr[position() > 1]"/>
\r
91 </xsl:call-template>
\r
98 <!-- Perform the actual table transformation -->
\r
100 <xsl:template name="processTable">
\r
101 <xsl:param name="id" />
\r
102 <xsl:param name="headRows" />
\r
103 <xsl:param name="bodyRows" />
\r
105 <xsl:variable name="headIdx">
\r
107 <xsl:when test="$headRows[@class='ricoHeading']">
\r
108 <xsl:value-of select="count($headRows[@class='ricoHeading']/preceding-sibling::*)+1"/>
\r
111 <xsl:value-of select="count($headRows)"/>
\r
116 <xsl:variable name="headMain" select="$headRows[position()=$headIdx]"/>
\r
117 <xsl:variable name="headCols" select="$headMain/xhtml:th | $headMain/xhtml:td"/>
\r
120 <p><xsl:value-of select="$id"/>
\r
121 <br />headRowCnt: <xsl:value-of select="count($headRows)"/>
\r
122 <br />headIdx: <xsl:value-of select="$headIdx"/>
\r
123 <br />bodyRowCnt: <xsl:value-of select="count($bodyRows)"/>
\r
127 <xsl:element name="div">
\r
128 <xsl:attribute name="id"><xsl:value-of select="concat($id,'_outerDiv')"/></xsl:attribute>
\r
129 <xsl:attribute name="class">ricoLG_outerDiv</xsl:attribute>
\r
130 <xsl:attribute name="onload"></xsl:attribute>
\r
132 <!-- Create frozen (left) pane -->
\r
134 <xsl:element name="div">
\r
135 <xsl:attribute name="id"><xsl:value-of select="concat($id,'_frozenTabsDiv')"/></xsl:attribute>
\r
136 <xsl:attribute name="class">ricoLG_frozenTabsDiv</xsl:attribute>
\r
138 <xsl:call-template name="convertTHead">
\r
139 <xsl:with-param name="rows" select="$headRows"/>
\r
140 <xsl:with-param name="headIdx" select="$headIdx"/>
\r
141 <xsl:with-param name="frozen" select="1"/>
\r
142 <xsl:with-param name="id" select="concat($id,'_tab0h')"/>
\r
143 </xsl:call-template>
\r
145 <xsl:call-template name="convertTBody">
\r
146 <xsl:with-param name="rows" select="$bodyRows"/>
\r
147 <xsl:with-param name="cols" select="$headCols"/>
\r
148 <xsl:with-param name="id" select="concat($id,'_tab0')"/>
\r
149 <xsl:with-param name="frozen" select="1"/>
\r
150 </xsl:call-template>
\r
154 <xsl:element name="div">
\r
155 <xsl:attribute name="id"><xsl:value-of select="concat($id,'_innerDiv')"/></xsl:attribute>
\r
156 <xsl:attribute name="class">ricoLG_innerDiv</xsl:attribute>
\r
158 <xsl:element name="div">
\r
159 <xsl:attribute name="id"><xsl:value-of select="concat($id,'_scrollTabsDiv')"/></xsl:attribute>
\r
160 <xsl:attribute name="class">ricoLG_scrollTabsDiv</xsl:attribute>
\r
162 <xsl:call-template name="convertTHead">
\r
163 <xsl:with-param name="rows" select="$headRows"/>
\r
164 <xsl:with-param name="headIdx" select="$headIdx"/>
\r
165 <xsl:with-param name="frozen" select="0"/>
\r
166 <xsl:with-param name="id" select="concat($id,'_tab1h')"/>
\r
167 </xsl:call-template>
\r
172 <xsl:element name="div">
\r
173 <xsl:attribute name="id"><xsl:value-of select="concat($id,'_scrollDiv')"/></xsl:attribute>
\r
174 <xsl:attribute name="class">ricoLG_scrollDiv</xsl:attribute>
\r
176 <xsl:call-template name="convertTBody">
\r
177 <xsl:with-param name="rows" select="$bodyRows"/>
\r
178 <xsl:with-param name="cols" select="$headCols"/>
\r
179 <xsl:with-param name="id" select="concat($id,'_tab1')"/>
\r
180 <xsl:with-param name="frozen" select="0"/>
\r
181 </xsl:call-template>
\r
189 <!-- Convert thead section -->
\r
191 <xsl:template name="convertTHead">
\r
192 <xsl:param name = "rows" />
\r
193 <xsl:param name = "headIdx" />
\r
194 <xsl:param name = "frozen" />
\r
195 <xsl:param name = "id" />
\r
196 <xsl:element name="table" use-attribute-sets="ricoTable">
\r
197 <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
\r
198 <xsl:attribute name="class">ricoLG_table ricoLG_top
\r
199 <xsl:if test="$frozen">ricoLG_left</xsl:if>
\r
200 <xsl:if test="not($frozen)">ricoLG_right</xsl:if>
\r
202 <xsl:element name="thead">
\r
203 <xsl:for-each select="$rows">
\r
205 <xsl:when test="position() = $headIdx">
\r
206 <xsl:apply-templates select="." mode="convertHeadRow">
\r
207 <xsl:with-param name="id" select="concat($id,'_main')"/>
\r
208 <xsl:with-param name="frozen" select="$frozen"/>
\r
209 </xsl:apply-templates>
\r
212 <xsl:apply-templates select="." mode="convertHeadRow">
\r
213 <xsl:with-param name="id" select="concat($id,'_',position())"/>
\r
214 <xsl:with-param name="frozen" select="$frozen"/>
\r
215 </xsl:apply-templates>
\r
225 <xsl:template match="*" mode="convertHeadRow">
\r
226 <xsl:param name = "id" />
\r
227 <xsl:param name = "frozen" />
\r
228 <xsl:variable name="class" select="@class"/>
\r
229 <xsl:variable name="cells" select="xhtml:th | xhtml:td"/>
\r
230 <xsl:element name="tr">
\r
231 <xsl:if test="$id">
\r
232 <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
\r
234 <xsl:attribute name="class">ricoLG_hdg <xsl:value-of select="$class"/></xsl:attribute>
\r
235 <xsl:for-each select="$cells[@class='ricoFrozen' and $frozen or not(@class='ricoFrozen') and not($frozen)]">
\r
237 <xsl:copy-of select="@*"/>
\r
238 <div class='ricoLG_col' style='width:100px'>
\r
239 <xsl:element name="div">
\r
240 <xsl:attribute name="class">ricoLG_cell <xsl:value-of select="@class"/></xsl:attribute>
\r
241 <xsl:copy-of select="* | @*[name()!='class'] | text()"/>
\r
250 <!-- Convert tbody section -->
\r
252 <xsl:template name="convertTBody">
\r
253 <xsl:param name = "rows" />
\r
254 <xsl:param name = "cols" />
\r
255 <xsl:param name = "id" />
\r
256 <xsl:param name = "frozen" />
\r
257 <xsl:element name="table" use-attribute-sets="ricoTable">
\r
258 <xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
\r
259 <xsl:attribute name="class">ricoLG_table ricoLG_bottom
\r
260 <xsl:if test="$frozen">ricoLG_left</xsl:if>
\r
261 <xsl:if test="not($frozen)">ricoLG_right</xsl:if>
\r
263 <xsl:element name="tbody">
\r
265 <xsl:for-each select="$cols">
\r
266 <xsl:if test="@class='ricoFrozen' and $frozen or not(@class='ricoFrozen') and not($frozen)">
\r
267 <xsl:variable name="colpos" select="position()"/>
\r
269 <div class='ricoLG_col' style='width:100px'>
\r
270 <xsl:for-each select="$rows">
\r
271 <xsl:element name="div">
\r
272 <xsl:attribute name="class">ricoLG_cell <xsl:value-of select="xhtml:td[$colpos]/@class"/></xsl:attribute>
\r
273 <xsl:copy-of select="xhtml:td[$colpos]/* | xhtml:td[$colpos]/@*[name()!='class'] | xhtml:td[$colpos]/text()"/>
\r