data.xsl 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: CCS
  5. (c) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:ccs="http://developer.cognos.com/rds/1">
  9. <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" version="1.0" cdata-section-elements="ccs:upStyleValue"/>
  10. <!--***********************************************************
  11. Parameters
  12. ***********************************************************-->
  13. <xsl:param name="transformData" select="'false'"/>
  14. <!--************************************************************
  15. Templates
  16. ************************************************************-->
  17. <xsl:template match="/">
  18. <ccs:cbits>
  19. <ccs:metaData>
  20. <ccs:id>1</ccs:id>
  21. <ccs:style/>
  22. <ccs:name>Report</ccs:name>
  23. <ccs:type>TopReport</ccs:type>
  24. <ccs:content>
  25. <ccs:title/>
  26. <ccs:topReport>
  27. <xsl:apply-templates select="data" mode="meta"/>
  28. </ccs:topReport>
  29. </ccs:content>
  30. </ccs:metaData>
  31. <ccs:data>
  32. <xsl:choose>
  33. <xsl:when test="$transformData = 'true' ">
  34. <ccs:id>1</ccs:id>
  35. <ccs:style/>
  36. <ccs:name>Report</ccs:name>
  37. <ccs:type>TopReport</ccs:type>
  38. <ccs:content>
  39. <ccs:title/>
  40. <ccs:topReport>
  41. <xsl:apply-templates select="data"/>
  42. </ccs:topReport>
  43. </ccs:content>
  44. </xsl:when>
  45. <xsl:otherwise/>
  46. </xsl:choose>
  47. </ccs:data>
  48. </ccs:cbits>
  49. </xsl:template>
  50. <!-- **********************************************************************
  51. This section handles data
  52. **********************************************************************-->
  53. <xsl:template match="data">
  54. <!--
  55. For PP, the foll. hard coded ids hold :
  56. id 1 : Top Report
  57. id 2 : Crosstab
  58. id 3 : Status line
  59. id 4: Page
  60. -->
  61. <ccs:pages>
  62. <ccs:id>4</ccs:id>
  63. <ccs:name/>
  64. <ccs:type>Page</ccs:type>
  65. <ccs:content>
  66. <ccs:page>
  67. <ccs:headerElement/>
  68. <ccs:bodyElements>
  69. <ccs:id>2</ccs:id>
  70. <ccs:name>Crosstab</ccs:name>
  71. <ccs:type>Table</ccs:type>
  72. <ccs:content>
  73. <ccs:table>
  74. <xsl:apply-templates select="tab/crosstab/datarow"/>
  75. </ccs:table>
  76. </ccs:content>
  77. </ccs:bodyElements>
  78. <ccs:footerElements>
  79. <xsl:choose>
  80. <xsl:when test="normalize-space(tab/status_line/@status)">
  81. <ccs:id>3</ccs:id>
  82. <ccs:name>statusLine</ccs:name>
  83. <ccs:type>TextFrame</ccs:type>
  84. <ccs:content>
  85. <ccs:textFrame>
  86. <ccs:value>
  87. <xsl:value-of select="tab/status_line/@status"/>
  88. </ccs:value>
  89. <ccs:valueType>text</ccs:valueType>
  90. </ccs:textFrame>
  91. </ccs:content>
  92. </xsl:when>
  93. </xsl:choose>
  94. </ccs:footerElements>
  95. </ccs:page>
  96. </ccs:content>
  97. </ccs:pages>
  98. <ccs:unprocessedStyle>
  99. <xsl:value-of select="tab/style/@details"/>
  100. </ccs:unprocessedStyle>
  101. <xsl:choose>
  102. <xsl:when test="tab/crosstab/datarow/col/@exception">
  103. <ccs:hasMoreUStyles>true</ccs:hasMoreUStyles>
  104. </xsl:when>
  105. <xsl:otherwise/>
  106. </xsl:choose>
  107. </xsl:template>
  108. <!-- get meta data about the rows or columns, will recurse to get nested rows or columns-->
  109. <xsl:template match="row">
  110. <ccs:rows>
  111. <ccs:isSummary>
  112. <xsl:choose>
  113. <xsl:when test="@summary">
  114. <xsl:value-of select="@summary"/>
  115. </xsl:when>
  116. <xsl:otherwise>false</xsl:otherwise>
  117. </xsl:choose>
  118. </ccs:isSummary>
  119. <ccs:startPos>
  120. <xsl:value-of select="@pos"/>
  121. </ccs:startPos>
  122. <ccs:name>
  123. <xsl:value-of select="@name"/>
  124. </ccs:name>
  125. <ccs:dimensionIndex>
  126. <xsl:value-of select="@dimIdx"/>
  127. </ccs:dimensionIndex>
  128. <ccs:size>0</ccs:size>
  129. <xsl:call-template name="labelStyle"/>
  130. <xsl:apply-templates mode="contained" select="row"/>
  131. </ccs:rows>
  132. </xsl:template>
  133. <xsl:template match="column">
  134. <ccs:columns>
  135. <ccs:isSummary>
  136. <xsl:choose>
  137. <xsl:when test="@summary">
  138. <xsl:value-of select="@summary"/>
  139. </xsl:when>
  140. <xsl:otherwise>false</xsl:otherwise>
  141. </xsl:choose>
  142. </ccs:isSummary>
  143. <ccs:startPos>
  144. <xsl:value-of select="@pos"/>
  145. </ccs:startPos>
  146. <ccs:name>
  147. <xsl:value-of select="@name"/>
  148. </ccs:name>
  149. <ccs:dimensionIndex>
  150. <xsl:value-of select="@dimIdx"/>
  151. </ccs:dimensionIndex>
  152. <ccs:size>0</ccs:size>
  153. <xsl:call-template name="labelStyle"/>
  154. <xsl:apply-templates mode="contained" select="column"/>
  155. </ccs:columns>
  156. </xsl:template>
  157. <xsl:template mode="contained" match="column|row">
  158. <ccs:containedGroup>
  159. <ccs:isSummary>
  160. <xsl:choose>
  161. <xsl:when test="@summary">
  162. <xsl:value-of select="@summary"/>
  163. </xsl:when>
  164. <xsl:otherwise>false</xsl:otherwise>
  165. </xsl:choose>
  166. </ccs:isSummary>
  167. <ccs:startPos>
  168. <xsl:value-of select="@pos"/>
  169. </ccs:startPos>
  170. <ccs:name>
  171. <xsl:value-of select="@name"/>
  172. </ccs:name>
  173. <ccs:dimensionIndex>
  174. <xsl:value-of select="@dimIdx"/>
  175. </ccs:dimensionIndex>
  176. <ccs:size>0</ccs:size>
  177. <xsl:call-template name="labelStyle"/>
  178. <xsl:choose>
  179. <xsl:when test="local-name() = 'row'">
  180. <xsl:apply-templates mode="contained" select="row"/>
  181. </xsl:when>
  182. <xsl:when test="local-name() = 'column'">
  183. <xsl:apply-templates mode="contained" select="column"/>
  184. </xsl:when>
  185. </xsl:choose>
  186. </ccs:containedGroup>
  187. </xsl:template>
  188. <!-- apply the class for the header -->
  189. <xsl:template name="labelStyle">
  190. <ccs:style>
  191. <xsl:choose>
  192. <xsl:when test="@suppressed">
  193. <xsl:choose>
  194. <xsl:when test="local-name() = 'row'">
  195. <xsl:choose>
  196. <xsl:when test="parent::row">8020rowlabelnested</xsl:when>
  197. <xsl:otherwise>8020rowlabel</xsl:otherwise>
  198. </xsl:choose>
  199. </xsl:when>
  200. <xsl:when test="local-name() = 'column'">
  201. <xsl:choose>
  202. <xsl:when test="parent::column">8020labelcolnested</xsl:when>
  203. <xsl:otherwise>8020collabel</xsl:otherwise>
  204. </xsl:choose>
  205. </xsl:when>
  206. </xsl:choose>
  207. </xsl:when>
  208. <xsl:when test="@calculation">
  209. <xsl:choose>
  210. <xsl:when test="local-name() = 'row'">
  211. <xsl:choose>
  212. <xsl:when test="parent::row">calculationrowlabelnested</xsl:when>
  213. <xsl:otherwise>calculationrowlabel</xsl:otherwise>
  214. </xsl:choose>
  215. </xsl:when>
  216. <xsl:when test="local-name() = 'column'">
  217. <xsl:choose>
  218. <xsl:when test="parent::column">calculationcollabelnested</xsl:when>
  219. <xsl:otherwise>calculationcollabel</xsl:otherwise>
  220. </xsl:choose>
  221. </xsl:when>
  222. </xsl:choose>
  223. </xsl:when>
  224. <xsl:when test="@summary">
  225. <xsl:choose>
  226. <xsl:when test="local-name() = 'row'">
  227. <xsl:choose>
  228. <xsl:when test="@summ_style_one">summaryrowlabelone</xsl:when>
  229. <xsl:otherwise>summaryrowlabeltwo</xsl:otherwise>
  230. </xsl:choose>
  231. </xsl:when>
  232. <xsl:when test="local-name() = 'column'">
  233. <xsl:choose>
  234. <xsl:when test="@summ_style_one">summarycollabelone</xsl:when>
  235. <xsl:otherwise>summarycollabeltwo</xsl:otherwise>
  236. </xsl:choose>
  237. </xsl:when>
  238. </xsl:choose>
  239. </xsl:when>
  240. <xsl:otherwise>
  241. <xsl:choose>
  242. <xsl:when test="local-name() = 'row'">
  243. <xsl:choose>
  244. <xsl:when test="parent::row">rowLabelNested</xsl:when>
  245. <xsl:otherwise>rowLabel</xsl:otherwise>
  246. </xsl:choose>
  247. </xsl:when>
  248. <xsl:when test="local-name() = 'column'">
  249. <xsl:choose>
  250. <xsl:when test="parent::column">colLabelNested</xsl:when>
  251. <xsl:otherwise>colLabel</xsl:otherwise>
  252. </xsl:choose>
  253. </xsl:when>
  254. </xsl:choose>
  255. </xsl:otherwise>
  256. </xsl:choose>
  257. </ccs:style>
  258. </xsl:template>
  259. <!-- get the data rows -->
  260. <xsl:template match="datarow">
  261. <ccs:row>
  262. <ccs:type>Detail</ccs:type>
  263. <xsl:for-each select="col">
  264. <ccs:cells>
  265. <ccs:parts>
  266. <ccs:id/>
  267. <ccs:type>TextFrame</ccs:type>
  268. <ccs:content>
  269. <ccs:textFrame>
  270. <ccs:value>
  271. <xsl:value-of select="."/>
  272. </ccs:value>
  273. <ccs:valueType>number</ccs:valueType>
  274. <ccs:dataFormat>
  275. <xsl:value-of select="@format"/>
  276. </ccs:dataFormat>
  277. </ccs:textFrame>
  278. </ccs:content>
  279. <xsl:call-template name="cellStyle"/>
  280. </ccs:parts>
  281. </ccs:cells>
  282. </xsl:for-each>
  283. </ccs:row>
  284. </xsl:template>
  285. <!-- apply the class for the data cells -->
  286. <xsl:template name="cellStyle">
  287. <ccs:style>
  288. <xsl:choose>
  289. <xsl:when test="@lowexception">lowexceptioncell</xsl:when>
  290. <xsl:when test="@highexception">highexceptioncell</xsl:when>
  291. <xsl:when test="@summary">
  292. <xsl:choose>
  293. <xsl:when test="@rank">
  294. <xsl:choose>
  295. <xsl:when test="@summ_style_one">summarycellonerank</xsl:when>
  296. <xsl:otherwise>summarycelltworank</xsl:otherwise>
  297. </xsl:choose>
  298. </xsl:when>
  299. <xsl:when test="@suppressed or @calculation">
  300. <xsl:choose>
  301. <xsl:when test="@summ_style_one">summarycelloneitalic</xsl:when>
  302. <xsl:otherwise>summarycelltwoitalic</xsl:otherwise>
  303. </xsl:choose>
  304. </xsl:when>
  305. <xsl:otherwise>
  306. <xsl:choose>
  307. <xsl:when test="@summ_style_one">summarycellone</xsl:when>
  308. <xsl:otherwise>summarycelltwo</xsl:otherwise>
  309. </xsl:choose>
  310. </xsl:otherwise>
  311. </xsl:choose>
  312. </xsl:when>
  313. <xsl:when test="@rank">rankcell</xsl:when>
  314. <xsl:when test="@calculation">calculationcell</xsl:when>
  315. <xsl:when test="@suppressed">8020cell</xsl:when>
  316. <xsl:otherwise>cell</xsl:otherwise>
  317. </xsl:choose>
  318. </ccs:style>
  319. <xsl:if test="@exception">
  320. <ccs:unprocessedStyle>
  321. <xsl:if test="@fontcolor">
  322. <xsl:value-of select="concat('color: #', ./@fontcolor, '; ')"/>
  323. </xsl:if>
  324. <xsl:if test="@bgcolor">
  325. <xsl:value-of select="concat('background-color: #', ./@bgcolor, '; ')"/>
  326. </xsl:if>
  327. <xsl:if test="@fontSize">
  328. <xsl:value-of select="concat('font-size: ', ./@fontSize, 'pt; ')"/>
  329. </xsl:if>
  330. <xsl:if test="@bold">font-weight: bold; </xsl:if>
  331. <xsl:if test="@italic">font-style: italic; </xsl:if>
  332. <xsl:if test="@underline">text-decoration: underline; </xsl:if>
  333. </ccs:unprocessedStyle>
  334. </xsl:if>
  335. </xsl:template>
  336. <!-- Tokenize the dimension line -->
  337. <xsl:template match="dimension_line">
  338. <xsl:call-template name="dimensions">
  339. <xsl:with-param name="dimStr" select="@details"/>
  340. </xsl:call-template>
  341. <ccs:style>dimLine</ccs:style>
  342. </xsl:template>
  343. <xsl:template name="dimensions">
  344. <xsl:param name="dimStr"/>
  345. <xsl:variable name="nextDim">
  346. <xsl:choose>
  347. <xsl:when test="starts-with($dimStr,'[')">
  348. <xsl:value-of select="substring-before(substring-after($dimStr,'['),']')"/>
  349. </xsl:when>
  350. <xsl:otherwise>
  351. <xsl:value-of select="$dimStr"/>
  352. </xsl:otherwise>
  353. </xsl:choose>
  354. </xsl:variable>
  355. <xsl:variable name="otherDims">
  356. <xsl:if test="contains($dimStr,'[')">
  357. <xsl:value-of select="substring-after($dimStr,']')"/>
  358. </xsl:if>
  359. </xsl:variable>
  360. <ccs:dimensions>
  361. <xsl:value-of select="$nextDim"/>
  362. </ccs:dimensions>
  363. <xsl:if test="string-length($otherDims) != 0">
  364. <xsl:call-template name="dimensions">
  365. <xsl:with-param name="dimStr" select="$otherDims"/>
  366. </xsl:call-template>
  367. </xsl:if>
  368. </xsl:template>
  369. <!--***************************************************************
  370. This section handles metadata
  371. **************************************************************** -->
  372. <xsl:template match="data" mode="meta">
  373. <!--
  374. For PP, the foll. hard coded ids hold :
  375. id 1 : Top Report
  376. id 2 : Crosstab
  377. id 3 : Status line
  378. id 4: Page
  379. -->
  380. <ccs:pages>
  381. <ccs:id>4</ccs:id>
  382. <ccs:name/>
  383. <ccs:type>Page</ccs:type>
  384. <ccs:content>
  385. <ccs:page>
  386. <ccs:headerElements/>
  387. <ccs:bodyElements>
  388. <ccs:id>2</ccs:id>
  389. <ccs:style>
  390. </ccs:style>
  391. <ccs:name>Crosstab</ccs:name>
  392. <ccs:type>Table</ccs:type>
  393. <ccs:content>
  394. <ccs:table>
  395. <ccs:isCrossTab>true</ccs:isCrossTab>
  396. <ccs:moreRows>
  397. <xsl:choose>
  398. <xsl:when test="string-length(tab/crosstab/@rowEnd) &gt; 0">true</xsl:when>
  399. <xsl:otherwise>false</xsl:otherwise>
  400. </xsl:choose>
  401. </ccs:moreRows>
  402. <ccs:moreCols>
  403. <xsl:choose>
  404. <xsl:when test="string-length(tab/crosstab/@colEnd) &gt; 0">true</xsl:when>
  405. <xsl:otherwise>false</xsl:otherwise>
  406. </xsl:choose>
  407. </ccs:moreCols>
  408. <xsl:apply-templates select="tab/dimension_line" mode="meta"/>
  409. <ccs:measure>
  410. <xsl:value-of select="tab/crosstab/measure/@name"/>
  411. <xsl:text> </xsl:text>
  412. <xsl:value-of select="tab/crosstab/measure/@type"/>
  413. </ccs:measure>
  414. <ccs:measureStyle>measurecell</ccs:measureStyle>
  415. <xsl:apply-templates select="tab/crosstab/rows/row" mode="meta"/>
  416. <xsl:apply-templates select="tab/crosstab/columns/column" mode="meta"/>
  417. </ccs:table>
  418. </ccs:content>
  419. </ccs:bodyElements>
  420. <ccs:footerElements>
  421. <xsl:choose>
  422. <xsl:when test="normalize-space(tab/status_line/@status)">
  423. <ccs:id>3</ccs:id>
  424. <ccs:name>statusLine</ccs:name>
  425. <ccs:type>TextFrame</ccs:type>
  426. <ccs:content>
  427. <ccs:textFrame>
  428. <ccs:hSize>0</ccs:hSize>
  429. <ccs:vSize>0</ccs:vSize>
  430. </ccs:textFrame>
  431. </ccs:content>
  432. </xsl:when>
  433. </xsl:choose>
  434. </ccs:footerElements>
  435. </ccs:page>
  436. </ccs:content>
  437. </ccs:pages>
  438. </xsl:template>
  439. <!-- get meta data about the rows or columns, will recurse to get nested rows or columns-->
  440. <xsl:template match="row" mode="meta">
  441. <ccs:rows>
  442. <ccs:isSummary>
  443. <xsl:choose>
  444. <xsl:when test="@summary">
  445. <xsl:value-of select="@summary"/>
  446. </xsl:when>
  447. <xsl:otherwise>false</xsl:otherwise>
  448. </xsl:choose>
  449. </ccs:isSummary>
  450. <ccs:startPos>
  451. <xsl:choose>
  452. <xsl:when test="@axis_pos">
  453. <xsl:value-of select="@axis_pos"/>
  454. </xsl:when>
  455. <xsl:otherwise>
  456. <xsl:value-of select="@pos"/>
  457. </xsl:otherwise>
  458. </xsl:choose>
  459. </ccs:startPos>
  460. <ccs:name>
  461. <xsl:value-of select="@name"/>
  462. </ccs:name>
  463. <ccs:dimensionIndex>
  464. <xsl:value-of select="@dimIdx"/>
  465. </ccs:dimensionIndex>
  466. <ccs:size>0</ccs:size>
  467. <xsl:call-template name="labelStyleMeta"/>
  468. <xsl:apply-templates mode="contained-meta" select="row"/>
  469. </ccs:rows>
  470. </xsl:template>
  471. <xsl:template match="column" mode="meta">
  472. <ccs:columns>
  473. <ccs:isSummary>
  474. <xsl:choose>
  475. <xsl:when test="@summary">
  476. <xsl:value-of select="@summary"/>
  477. </xsl:when>
  478. <xsl:otherwise>false</xsl:otherwise>
  479. </xsl:choose>
  480. </ccs:isSummary>
  481. <ccs:startPos>
  482. <xsl:choose>
  483. <xsl:when test="@axis_pos">
  484. <xsl:value-of select="@axis_pos"/>
  485. </xsl:when>
  486. <xsl:otherwise>
  487. <xsl:value-of select="@pos"/>
  488. </xsl:otherwise>
  489. </xsl:choose>
  490. </ccs:startPos>
  491. <ccs:name>
  492. <xsl:value-of select="@name"/>
  493. </ccs:name>
  494. <ccs:dimensionIndex>
  495. <xsl:value-of select="@dimIdx"/>
  496. </ccs:dimensionIndex>
  497. <ccs:size>0</ccs:size>
  498. <xsl:call-template name="labelStyleMeta"/>
  499. <xsl:apply-templates mode="contained-meta" select="column"/>
  500. </ccs:columns>
  501. </xsl:template>
  502. <xsl:template mode="contained-meta" match="column|row">
  503. <ccs:containedGroup>
  504. <ccs:isSummary>
  505. <xsl:choose>
  506. <xsl:when test="@summary">
  507. <xsl:value-of select="@summary"/>
  508. </xsl:when>
  509. <xsl:otherwise>false</xsl:otherwise>
  510. </xsl:choose>
  511. </ccs:isSummary>
  512. <ccs:startPos>
  513. <xsl:choose>
  514. <xsl:when test="@axis_pos">
  515. <xsl:value-of select="@axis_pos"/>
  516. </xsl:when>
  517. <xsl:otherwise>
  518. <xsl:value-of select="@pos"/>
  519. </xsl:otherwise>
  520. </xsl:choose>
  521. </ccs:startPos>
  522. <ccs:name>
  523. <xsl:value-of select="@name"/>
  524. </ccs:name>
  525. <ccs:dimensionIndex>
  526. <xsl:value-of select="@dimIdx"/>
  527. </ccs:dimensionIndex>
  528. <ccs:size>0</ccs:size>
  529. <xsl:call-template name="labelStyleMeta"/>
  530. <xsl:choose>
  531. <xsl:when test="local-name() = 'row'">
  532. <xsl:apply-templates mode="contained-meta" select="row"/>
  533. </xsl:when>
  534. <xsl:when test="local-name() = 'column'">
  535. <xsl:apply-templates mode="contained-meta" select="column"/>
  536. </xsl:when>
  537. </xsl:choose>
  538. </ccs:containedGroup>
  539. <ccs:columnType>
  540. <ccs:id/>
  541. <ccs:style/>
  542. <ccs:name/>
  543. <ccs:type>TextFrame</ccs:type>
  544. <ccs:content>
  545. <ccs:textFrame>
  546. <ccs:hSize>0</ccs:hSize>
  547. <ccs:vSize>0</ccs:vSize>
  548. </ccs:textFrame>
  549. </ccs:content>
  550. </ccs:columnType>
  551. </xsl:template>
  552. <!-- apply the class for the header -->
  553. <xsl:template name="labelStyleMeta">
  554. <ccs:style>
  555. <xsl:choose>
  556. <xsl:when test="@suppressed">
  557. <xsl:choose>
  558. <xsl:when test="local-name() = 'row'">
  559. <xsl:choose>
  560. <xsl:when test="parent::row">8020rowlabelnested</xsl:when>
  561. <xsl:otherwise>8020rowlabel</xsl:otherwise>
  562. </xsl:choose>
  563. </xsl:when>
  564. <xsl:when test="local-name() = 'column'">
  565. <xsl:choose>
  566. <xsl:when test="parent::column">8020labelcolnested</xsl:when>
  567. <xsl:otherwise>8020collabel</xsl:otherwise>
  568. </xsl:choose>
  569. </xsl:when>
  570. </xsl:choose>
  571. </xsl:when>
  572. <xsl:when test="@calculation">
  573. <xsl:choose>
  574. <xsl:when test="local-name() = 'row'">
  575. <xsl:choose>
  576. <xsl:when test="parent::row">calculationrowlabelnested</xsl:when>
  577. <xsl:otherwise>calculationrowlabel</xsl:otherwise>
  578. </xsl:choose>
  579. </xsl:when>
  580. <xsl:when test="local-name() = 'column'">
  581. <xsl:choose>
  582. <xsl:when test="parent::column">calculationcollabelnested</xsl:when>
  583. <xsl:otherwise>calculationcollabel</xsl:otherwise>
  584. </xsl:choose>
  585. </xsl:when>
  586. </xsl:choose>
  587. </xsl:when>
  588. <xsl:when test="@summary">
  589. <xsl:choose>
  590. <xsl:when test="local-name() = 'row'">
  591. <xsl:choose>
  592. <xsl:when test="@summ_style_one">summaryrowlabelone</xsl:when>
  593. <xsl:otherwise>summaryrowlabeltwo</xsl:otherwise>
  594. </xsl:choose>
  595. </xsl:when>
  596. <xsl:when test="local-name() = 'column'">
  597. <xsl:choose>
  598. <xsl:when test="@summ_style_one">summarycollabelone</xsl:when>
  599. <xsl:otherwise>summarycollabeltwo</xsl:otherwise>
  600. </xsl:choose>
  601. </xsl:when>
  602. </xsl:choose>
  603. </xsl:when>
  604. <xsl:otherwise>
  605. <xsl:choose>
  606. <xsl:when test="local-name() = 'row'">
  607. <xsl:choose>
  608. <xsl:when test="parent::row">rowLabelNested</xsl:when>
  609. <xsl:otherwise>rowLabel</xsl:otherwise>
  610. </xsl:choose>
  611. </xsl:when>
  612. <xsl:when test="local-name() = 'column'">
  613. <xsl:choose>
  614. <xsl:when test="parent::column">colLabelNested</xsl:when>
  615. <xsl:otherwise>colLabel</xsl:otherwise>
  616. </xsl:choose>
  617. </xsl:when>
  618. </xsl:choose>
  619. </xsl:otherwise>
  620. </xsl:choose>
  621. </ccs:style>
  622. </xsl:template>
  623. <!-- get the data rows -->
  624. <xsl:template match="datarow" mode="meta">
  625. <ccs:row>
  626. <ccs:type>Detail</ccs:type>
  627. <xsl:for-each select="col">
  628. <ccs:cells>
  629. <ccs:id/>
  630. <ccs:type>TextFrame</ccs:type>
  631. <ccs:content>
  632. <ccs:textFrame>
  633. <ccs:value>
  634. <xsl:value-of select="."/>
  635. </ccs:value>
  636. <ccs:dataFormat>
  637. <xsl:value-of select="@format"/>
  638. </ccs:dataFormat>
  639. </ccs:textFrame>
  640. </ccs:content>
  641. <xsl:call-template name="cellStyleMeta"/>
  642. </ccs:cells>
  643. </xsl:for-each>
  644. </ccs:row>
  645. </xsl:template>
  646. <!-- apply the class for the data cells -->
  647. <xsl:template name="cellStyleMeta">
  648. <ccs:style>
  649. <xsl:choose>
  650. <xsl:when test="@lowexception">lowexceptioncell</xsl:when>
  651. <xsl:when test="@highexception">highexceptioncell</xsl:when>
  652. <xsl:when test="@summary">
  653. <xsl:choose>
  654. <xsl:when test="@rank">
  655. <xsl:choose>
  656. <xsl:when test="@summ_style_one">summarycellonerank</xsl:when>
  657. <xsl:otherwise>summarycelltworank</xsl:otherwise>
  658. </xsl:choose>
  659. </xsl:when>
  660. <xsl:when test="@suppressed or @calculation">
  661. <xsl:choose>
  662. <xsl:when test="@summ_style_one">summarycelloneitalic</xsl:when>
  663. <xsl:otherwise>summarycelltwoitalic</xsl:otherwise>
  664. </xsl:choose>
  665. </xsl:when>
  666. <xsl:otherwise>
  667. <xsl:choose>
  668. <xsl:when test="@summ_style_one">summarycellone</xsl:when>
  669. <xsl:otherwise>summarycelltwo</xsl:otherwise>
  670. </xsl:choose>
  671. </xsl:otherwise>
  672. </xsl:choose>
  673. </xsl:when>
  674. <xsl:when test="@rank">rankcell</xsl:when>
  675. <xsl:when test="@calculation">calculationcell</xsl:when>
  676. <xsl:when test="@suppressed">8020cell</xsl:when>
  677. <xsl:otherwise>cell</xsl:otherwise>
  678. </xsl:choose>
  679. </ccs:style>
  680. </xsl:template>
  681. <!-- Tokenize the dimension line -->
  682. <xsl:template match="dimension_line" mode="meta">
  683. <xsl:call-template name="dimensionsMeta">
  684. <xsl:with-param name="dimStr" select="@details"/>
  685. </xsl:call-template>
  686. <ccs:style>dimLine</ccs:style>
  687. </xsl:template>
  688. <xsl:template name="dimensionsMeta">
  689. <xsl:param name="dimStr"/>
  690. <xsl:variable name="nextDim">
  691. <xsl:choose>
  692. <xsl:when test="starts-with($dimStr,'[')">
  693. <xsl:value-of select="substring-before(substring-after($dimStr,'['),']')"/>
  694. </xsl:when>
  695. <xsl:otherwise>
  696. <xsl:value-of select="$dimStr"/>
  697. </xsl:otherwise>
  698. </xsl:choose>
  699. </xsl:variable>
  700. <xsl:variable name="otherDims">
  701. <xsl:if test="contains($dimStr,'[')">
  702. <xsl:value-of select="substring-after($dimStr,']')"/>
  703. </xsl:if>
  704. </xsl:variable>
  705. <ccs:dimensions>
  706. <xsl:value-of select="$nextDim"/>
  707. </ccs:dimensions>
  708. <xsl:if test="string-length($otherDims) != 0">
  709. <xsl:call-template name="dimensionsMeta">
  710. <xsl:with-param name="dimStr" select="$otherDims"/>
  711. </xsl:call-template>
  712. </xsl:if>
  713. </xsl:template>
  714. </xsl:stylesheet>