layout.xsl 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  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="http://developer.cognos.com/schemas/rds/types/1" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdsCM="http://developer.cognos.com/schemas/rds/contentmodel/1">
  9. <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" version="1.0"/>
  10. <xsl:template match="/">
  11. <layout>
  12. <xsl:apply-templates select="/report/layouts/layout/reportPages/*"/>
  13. <xsl:apply-templates select="/report/classStyles/*"/>
  14. </layout>
  15. </xsl:template>
  16. <xsl:template match="pageSet">
  17. <xsl:apply-templates select="./pageOverallGroup/headerPages/*"/>
  18. <xsl:apply-templates select="./detailPages/*"/>
  19. <xsl:apply-templates select="./pageOverallGroup/footerPages/*"/>
  20. <xsl:for-each select="./pageGroups/pageGroup">
  21. <xsl:apply-templates select="headerPages/*"/>
  22. <xsl:apply-templates select="footerPages/*"/>
  23. </xsl:for-each>
  24. </xsl:template>
  25. <xsl:template match="page">
  26. <xsl:variable name="countType">
  27. <xsl:value-of select="count(../page)"/>
  28. </xsl:variable>
  29. <xsl:variable name="index">
  30. <xsl:value-of select="1 + count(preceding-sibling::page)"/>
  31. </xsl:variable>
  32. <page>
  33. <xsl:if test="@name">
  34. <rdsCM:id>
  35. <xsl:value-of select="@name"/>
  36. </rdsCM:id>
  37. </xsl:if>
  38. <posId>
  39. <xsl:choose>
  40. <xsl:when test="$countType &gt; 1">
  41. <xsl:value-of select="concat('./layouts/layout/reportPages/page[',$index,']')"/>
  42. </xsl:when>
  43. <xsl:otherwise>./layouts/layout/reportPages/page</xsl:otherwise>
  44. </xsl:choose>
  45. </posId>
  46. <xsl:if test="pageHeader/contents/*">
  47. <header>
  48. <xsl:apply-templates select="pageHeader/contents/*">
  49. <xsl:with-param name="posId">
  50. <xsl:choose>
  51. <xsl:when test="$countType &gt; 1">
  52. <xsl:value-of select="concat('./layouts/layout/reportPages/page[',$index,']/pageHeader/contents')"/>
  53. </xsl:when>
  54. <xsl:otherwise>./layouts/layout/reportPages/page/pageHeader/contents</xsl:otherwise>
  55. </xsl:choose>
  56. </xsl:with-param>
  57. </xsl:apply-templates>
  58. </header>
  59. </xsl:if>
  60. <xsl:if test="pageBody/contents/*">
  61. <body>
  62. <xsl:apply-templates select="pageBody/contents/*">
  63. <xsl:with-param name="posId">
  64. <xsl:choose>
  65. <xsl:when test="$countType &gt; 1">
  66. <xsl:value-of select="concat('./layouts/layout/reportPages/page[',$index,']/pageBody/contents')"/>
  67. </xsl:when>
  68. <xsl:otherwise>./layouts/layout/reportPages/page/pageBody/contents</xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:with-param>
  71. </xsl:apply-templates>
  72. </body>
  73. </xsl:if>
  74. <xsl:if test="pageFooter/contents/*">
  75. <footer>
  76. <xsl:apply-templates select="pageFooter/contents/*">
  77. <xsl:with-param name="posId">
  78. <xsl:choose>
  79. <xsl:when test="$countType &gt; 1">
  80. <xsl:value-of select="concat('./layouts/layout/reportPages/page[',$index,']/pageFooter/contents')"/>
  81. </xsl:when>
  82. <xsl:otherwise>./layouts/layout/reportPages/page/pageFooter/contents</xsl:otherwise>
  83. </xsl:choose>
  84. </xsl:with-param>
  85. </xsl:apply-templates>
  86. </footer>
  87. </xsl:if>
  88. </page>
  89. </xsl:template>
  90. <xsl:template match="table">
  91. <xsl:param name="posId"/>
  92. <xsl:variable name="countType">
  93. <xsl:value-of select="count(../table)"/>
  94. </xsl:variable>
  95. <xsl:variable name="index">
  96. <xsl:value-of select="1 + count(preceding-sibling::table)"/>
  97. </xsl:variable>
  98. <item>
  99. <LTable>
  100. <xsl:apply-templates select="tableRows/tableRow">
  101. <xsl:with-param name="posId">
  102. <xsl:choose>
  103. <xsl:when test="$countType &gt; 1">
  104. <xsl:value-of select="concat($posId,'/table[',$index,']')"/>
  105. </xsl:when>
  106. <xsl:otherwise>
  107. <xsl:value-of select="concat($posId,'/table')"/>
  108. </xsl:otherwise>
  109. </xsl:choose>
  110. </xsl:with-param>
  111. </xsl:apply-templates>
  112. <xsl:if test="style/CSS">
  113. <CSSStyle>
  114. <xsl:value-of select="style/CSS/@value"/>
  115. </CSSStyle>
  116. </xsl:if>
  117. <xsl:apply-templates select="style/defaultStyles/*"/>
  118. </LTable>
  119. </item>
  120. </xsl:template>
  121. <xsl:template match="tableRow">
  122. <xsl:param name="posId"/>
  123. <xsl:variable name="countType">
  124. <xsl:value-of select="count(../tableRow)"/>
  125. </xsl:variable>
  126. <xsl:variable name="index">
  127. <xsl:value-of select="1 + count(preceding-sibling::tableRow)"/>
  128. </xsl:variable>
  129. <row>
  130. <xsl:apply-templates select="tableCells/tableCell">
  131. <xsl:with-param name="posId">
  132. <xsl:choose>
  133. <xsl:when test="$countType &gt; 1">
  134. <xsl:value-of select="concat($posId,'/tableRows/tableRow[',$index,']')"/>
  135. </xsl:when>
  136. <xsl:otherwise>
  137. <xsl:value-of select="concat($posId,'/tableRows/tableRow')"/>
  138. </xsl:otherwise>
  139. </xsl:choose>
  140. </xsl:with-param>
  141. </xsl:apply-templates>
  142. <xsl:if test="style/CSS">
  143. <CSSStyle>
  144. <xsl:value-of select="style/CSS/@value"/>
  145. </CSSStyle>
  146. </xsl:if>
  147. <xsl:apply-templates select="style/defaultStyles/*"/>
  148. </row>
  149. </xsl:template>
  150. <xsl:template match="tableCell">
  151. <xsl:param name="posId"/>
  152. <xsl:variable name="countType">
  153. <xsl:value-of select="count(../tableCell)"/>
  154. </xsl:variable>
  155. <xsl:variable name="index">
  156. <xsl:value-of select="1 + count(preceding-sibling::tableCell)"/>
  157. </xsl:variable>
  158. <cell>
  159. <xsl:apply-templates select="contents/*">
  160. <xsl:with-param name="posId">
  161. <xsl:choose>
  162. <xsl:when test="$countType &gt; 1">
  163. <xsl:value-of select="concat($posId,'/tableCells/tableCell[',$index,']/contents')"/>
  164. </xsl:when>
  165. <xsl:otherwise>
  166. <xsl:value-of select="concat($posId,'/tableCells/tableCell/contents')"/>
  167. </xsl:otherwise>
  168. </xsl:choose>
  169. </xsl:with-param>
  170. </xsl:apply-templates>
  171. <xsl:if test="style/CSS">
  172. <CSSStyle>
  173. <xsl:value-of select="style/CSS/@value"/>
  174. </CSSStyle>
  175. </xsl:if>
  176. <xsl:apply-templates select="style/defaultStyles/*"/>
  177. </cell>
  178. </xsl:template>
  179. <xsl:template match="block">
  180. <xsl:param name="posId"/>
  181. <xsl:variable name="countType">
  182. <xsl:value-of select="count(../block)"/>
  183. </xsl:variable>
  184. <xsl:variable name="index">
  185. <xsl:value-of select="1 + count(preceding-sibling::block)"/>
  186. </xsl:variable>
  187. <item>
  188. <LContainer>
  189. <xsl:apply-templates select="contents/*">
  190. <xsl:with-param name="posId">
  191. <xsl:choose>
  192. <xsl:when test="$countType &gt; 1">
  193. <xsl:value-of select="concat($posId,'/block[',$index,']/contents')"/>
  194. </xsl:when>
  195. <xsl:otherwise>
  196. <xsl:value-of select="concat($posId,'/block/contents')"/>
  197. </xsl:otherwise>
  198. </xsl:choose>
  199. </xsl:with-param>
  200. </xsl:apply-templates>
  201. <xsl:if test="style/CSS">
  202. <CSSStyle>
  203. <xsl:value-of select="style/CSS/@value"/>
  204. </CSSStyle>
  205. </xsl:if>
  206. <xsl:apply-templates select="style/defaultStyles/*"/>
  207. </LContainer>
  208. </item>
  209. </xsl:template>
  210. <xsl:template match="list">
  211. <xsl:param name="posId"/>
  212. <xsl:variable name="countType">
  213. <xsl:value-of select="count(../list)"/>
  214. </xsl:variable>
  215. <xsl:variable name="index">
  216. <xsl:value-of select="1 + count(preceding-sibling::list)"/>
  217. </xsl:variable>
  218. <item>
  219. <LReference>
  220. <xsl:if test="@name">
  221. <rdsCM:id>
  222. <xsl:value-of select="@name"/>
  223. </rdsCM:id>
  224. </xsl:if>
  225. <posId>
  226. <xsl:choose>
  227. <xsl:when test="$countType &gt; 1">
  228. <xsl:value-of select="concat($posId,'/list[',$index,']')"/>
  229. </xsl:when>
  230. <xsl:otherwise>
  231. <xsl:value-of select="concat($posId,'/list')"/>
  232. </xsl:otherwise>
  233. </xsl:choose>
  234. </posId>
  235. </LReference>
  236. </item>
  237. </xsl:template>
  238. <xsl:template match="TOC">
  239. <xsl:param name="posId"/>
  240. <xsl:variable name="countType">
  241. <xsl:value-of select="count(../TOC)"/>
  242. </xsl:variable>
  243. <xsl:variable name="index">
  244. <xsl:value-of select="1 + count(preceding-sibling::TOC)"/>
  245. </xsl:variable>
  246. <item>
  247. <LReference>
  248. <xsl:if test="@tocName">
  249. <rdsCM:id>
  250. <xsl:value-of select="@tocName"/>
  251. </rdsCM:id>
  252. </xsl:if>
  253. <posId>
  254. <xsl:choose>
  255. <xsl:when test="$countType &gt; 1">
  256. <xsl:value-of select="concat($posId,'/TOC[',$index,']')"/>
  257. </xsl:when>
  258. <xsl:otherwise>
  259. <xsl:value-of select="concat($posId,'/TOC')"/>
  260. </xsl:otherwise>
  261. </xsl:choose>
  262. </posId>
  263. </LReference>
  264. </item>
  265. </xsl:template>
  266. <xsl:template match="textItem">
  267. <xsl:param name="posId"/>
  268. <xsl:variable name="countType">
  269. <xsl:value-of select="count(../textItem)"/>
  270. </xsl:variable>
  271. <xsl:variable name="index">
  272. <xsl:value-of select="1 + count(preceding-sibling::textItem)"/>
  273. </xsl:variable>
  274. <item>
  275. <LReference>
  276. <xsl:if test="@name">
  277. <rdsCM:id>
  278. <xsl:value-of select="@name"/>
  279. </rdsCM:id>
  280. </xsl:if>
  281. <posId>
  282. <xsl:choose>
  283. <xsl:when test="$countType &gt; 1">
  284. <xsl:value-of select="concat($posId,'/textItem[',$index,']')"/>
  285. </xsl:when>
  286. <xsl:otherwise>
  287. <xsl:value-of select="concat($posId,'/textItem')"/>
  288. </xsl:otherwise>
  289. </xsl:choose>
  290. </posId>
  291. </LReference>
  292. </item>
  293. </xsl:template>
  294. <xsl:template match="image">
  295. <xsl:param name="posId"/>
  296. <xsl:variable name="countType">
  297. <xsl:value-of select="count(../image)"/>
  298. </xsl:variable>
  299. <xsl:variable name="index">
  300. <xsl:value-of select="1 + count(preceding-sibling::image)"/>
  301. </xsl:variable>
  302. <item>
  303. <LReference>
  304. <xsl:if test="@name">
  305. <rdsCM:id>
  306. <xsl:value-of select="@name"/>
  307. </rdsCM:id>
  308. </xsl:if>
  309. <posId>
  310. <xsl:choose>
  311. <xsl:when test="$countType &gt; 1">
  312. <xsl:value-of select="concat($posId,'/image[',$index,']')"/>
  313. </xsl:when>
  314. <xsl:otherwise>
  315. <xsl:value-of select="concat($posId,'/image')"/>
  316. </xsl:otherwise>
  317. </xsl:choose>
  318. </posId>
  319. </LReference>
  320. </item>
  321. </xsl:template>
  322. <xsl:template match="crosstab">
  323. <xsl:param name="posId"/>
  324. <xsl:variable name="countType">
  325. <xsl:value-of select="count(../crosstab)"/>
  326. </xsl:variable>
  327. <xsl:variable name="index">
  328. <xsl:value-of select="1 + count(preceding-sibling::crosstab)"/>
  329. </xsl:variable>
  330. <item>
  331. <LReference>
  332. <xsl:if test="@name">
  333. <rdsCM:id>
  334. <xsl:value-of select="@name"/>
  335. </rdsCM:id>
  336. </xsl:if>
  337. <posId>
  338. <xsl:choose>
  339. <xsl:when test="$countType &gt; 1">
  340. <xsl:value-of select="concat($posId,'/crosstab[',$index,']')"/>
  341. </xsl:when>
  342. <xsl:otherwise>
  343. <xsl:value-of select="concat($posId,'/crosstab')"/>
  344. </xsl:otherwise>
  345. </xsl:choose>
  346. </posId>
  347. </LReference>
  348. </item>
  349. </xsl:template>
  350. <xsl:template match="repeaterTable">
  351. <xsl:param name="posId"/>
  352. <xsl:variable name="countType">
  353. <xsl:value-of select="count(../repeaterTable)"/>
  354. </xsl:variable>
  355. <xsl:variable name="index">
  356. <xsl:value-of select="1 + count(preceding-sibling::repeaterTable)"/>
  357. </xsl:variable>
  358. <xsl:variable name="rptId">
  359. <xsl:choose>
  360. <xsl:when test="$countType &gt; 1">
  361. <xsl:value-of select="concat($posId,'/repeaterTable[',$index,']')"/>
  362. </xsl:when>
  363. <xsl:otherwise>
  364. <xsl:value-of select="concat($posId,'/repeaterTable')"/>
  365. </xsl:otherwise>
  366. </xsl:choose>
  367. </xsl:variable>
  368. <item>
  369. <LRepeater>
  370. <xsl:if test="@name">
  371. <rdsCM:id>
  372. <xsl:value-of select="@name"/>
  373. </rdsCM:id>
  374. </xsl:if>
  375. <posId>
  376. <xsl:value-of select="$rptId"/>
  377. </posId>
  378. <layout>
  379. <xsl:apply-templates select="repeaterTableCell/contents/*">
  380. <xsl:with-param name="posId">
  381. <xsl:choose>
  382. <xsl:when test="$countType &gt; 1">
  383. <xsl:value-of select="concat($rptId,'/repeaterTableCell/contents[',$index,']')"/>
  384. </xsl:when>
  385. <xsl:otherwise>
  386. <xsl:value-of select="concat($rptId,'/repeaterTableCell/contents')"/>
  387. </xsl:otherwise>
  388. </xsl:choose>
  389. </xsl:with-param>
  390. </xsl:apply-templates>
  391. <xsl:if test="style/CSS">
  392. <CSSStyle>
  393. <xsl:value-of select="style/CSS/@value"/>
  394. </CSSStyle>
  395. </xsl:if>
  396. <xsl:apply-templates select="style/defaultStyles/*"/>
  397. </layout>
  398. </LRepeater>
  399. </item>
  400. </xsl:template>
  401. <xsl:template match="repeater">
  402. <xsl:param name="posId"/>
  403. <xsl:variable name="countType">
  404. <xsl:value-of select="count(../repeater)"/>
  405. </xsl:variable>
  406. <xsl:variable name="index">
  407. <xsl:value-of select="1 + count(preceding-sibling::repeater)"/>
  408. </xsl:variable>
  409. <xsl:variable name="rptId">
  410. <xsl:choose>
  411. <xsl:when test="$countType &gt; 1">
  412. <xsl:value-of select="concat($posId,'/repeater[',$index,']')"/>
  413. </xsl:when>
  414. <xsl:otherwise>
  415. <xsl:value-of select="concat($posId,'/repeater')"/>
  416. </xsl:otherwise>
  417. </xsl:choose>
  418. </xsl:variable>
  419. <item>
  420. <LRepeater>
  421. <xsl:if test="@name">
  422. <rdsCM:id>
  423. <xsl:value-of select="@name"/>
  424. </rdsCM:id>
  425. </xsl:if>
  426. <posId>
  427. <xsl:value-of select="$rptId"/>
  428. </posId>
  429. <layout>
  430. <xsl:apply-templates select="contents/*">
  431. <xsl:with-param name="posId">
  432. <xsl:choose>
  433. <xsl:when test="$countType &gt; 1">
  434. <xsl:value-of select="concat($posId,'/repeater/contents[',$index,']')"/>
  435. </xsl:when>
  436. <xsl:otherwise>
  437. <xsl:value-of select="concat($posId,'/repeater/contents')"/>
  438. </xsl:otherwise>
  439. </xsl:choose>
  440. </xsl:with-param>
  441. </xsl:apply-templates>
  442. <xsl:if test="style/CSS">
  443. <CSSStyle>
  444. <xsl:value-of select="style/CSS/@value"/>
  445. </CSSStyle>
  446. </xsl:if>
  447. <xsl:apply-templates select="style/defaultStyles/*"/>
  448. </layout>
  449. </LRepeater>
  450. </item>
  451. </xsl:template>
  452. <xsl:template match="hyperlink">
  453. <xsl:param name="posId"/>
  454. <xsl:variable name="countType">
  455. <xsl:value-of select="count(../hyperlink)"/>
  456. </xsl:variable>
  457. <xsl:variable name="index">
  458. <xsl:value-of select="1 + count(preceding-sibling::hyperlink)"/>
  459. </xsl:variable>
  460. <item>
  461. <LReference>
  462. <xsl:if test="@name">
  463. <rdsCM:id>
  464. <xsl:value-of select="@name"/>
  465. </rdsCM:id>
  466. </xsl:if>
  467. <posId>
  468. <xsl:choose>
  469. <xsl:when test="$countType &gt; 1">
  470. <xsl:value-of select="concat($posId,'/hyperlink[',$index,']')"/>
  471. </xsl:when>
  472. <xsl:otherwise>
  473. <xsl:value-of select="concat($posId,'/hyperlink')"/>
  474. </xsl:otherwise>
  475. </xsl:choose>
  476. </posId>
  477. </LReference>
  478. </item>
  479. </xsl:template>
  480. <xsl:template match="button">
  481. <!--Not yet handled-->
  482. </xsl:template>
  483. <xsl:template match="promptButton">
  484. <!--Not yet handled-->
  485. </xsl:template>
  486. <xsl:template match="HTMLItem">
  487. <xsl:param name="posId"/>
  488. <xsl:variable name="countType">
  489. <xsl:value-of select="count(../HTMLItem)"/>
  490. </xsl:variable>
  491. <xsl:variable name="index">
  492. <xsl:value-of select="1 + count(preceding-sibling::HTMLItem)"/>
  493. </xsl:variable>
  494. <item>
  495. <LReference>
  496. <xsl:if test="@name">
  497. <rdsCM:id>
  498. <xsl:value-of select="@name"/>
  499. </rdsCM:id>
  500. </xsl:if>
  501. <posId>
  502. <xsl:choose>
  503. <xsl:when test="$countType &gt; 1">
  504. <xsl:value-of select="concat($posId,'/HTMLItem[',$index,']')"/>
  505. </xsl:when>
  506. <xsl:otherwise>
  507. <xsl:value-of select="concat($posId,'/HTMLItem')"/>
  508. </xsl:otherwise>
  509. </xsl:choose>
  510. </posId>
  511. </LReference>
  512. </item>
  513. </xsl:template>
  514. <xsl:template match="richTextItem">
  515. <xsl:param name="posId"/>
  516. <xsl:variable name="countType">
  517. <xsl:value-of select="count(../richTextItem)"/>
  518. </xsl:variable>
  519. <xsl:variable name="index">
  520. <xsl:value-of select="1 + count(preceding-sibling::richTextItem)"/>
  521. </xsl:variable>
  522. <item>
  523. <LReference>
  524. <xsl:if test="@name">
  525. <rdsCM:id>
  526. <xsl:value-of select="@name"/>
  527. </rdsCM:id>
  528. </xsl:if>
  529. <posId>
  530. <xsl:choose>
  531. <xsl:when test="$countType &gt; 1">
  532. <xsl:value-of select="concat($posId,'/richTextItem[',$index,']')"/>
  533. </xsl:when>
  534. <xsl:otherwise>
  535. <xsl:value-of select="concat($posId,'/richTextItem')"/>
  536. </xsl:otherwise>
  537. </xsl:choose>
  538. </posId>
  539. </LReference>
  540. </item>
  541. </xsl:template>
  542. <xsl:template match="bookmark">
  543. <xsl:param name="posId"/>
  544. <xsl:variable name="countType">
  545. <xsl:value-of select="count(../bookmark)"/>
  546. </xsl:variable>
  547. <xsl:variable name="index">
  548. <xsl:value-of select="1 + count(preceding-sibling::bookmark)"/>
  549. </xsl:variable>
  550. <item>
  551. <LReference>
  552. <xsl:if test="@name">
  553. <rdsCM:id>
  554. <xsl:value-of select="@name"/>
  555. </rdsCM:id>
  556. </xsl:if>
  557. <posId>
  558. <xsl:choose>
  559. <xsl:when test="$countType &gt; 1">
  560. <xsl:value-of select="concat($posId,'/bookmark[',$index,']')"/>
  561. </xsl:when>
  562. <xsl:otherwise>
  563. <xsl:value-of select="concat($posId,'/bookmark')"/>
  564. </xsl:otherwise>
  565. </xsl:choose>
  566. </posId>
  567. </LReference>
  568. </item>
  569. </xsl:template>
  570. <xsl:template match="TOCEntry">
  571. <xsl:param name="posId"/>
  572. <xsl:variable name="countType">
  573. <xsl:value-of select="count(../TOCEntry)"/>
  574. </xsl:variable>
  575. <xsl:variable name="index">
  576. <xsl:value-of select="1 + count(preceding-sibling::TOCEntry)"/>
  577. </xsl:variable>
  578. <item>
  579. <!-- TOCEntry items are also mapped to bookmark object -->
  580. <!-- Note: neither TOCEntry nor bookmark have name attrbitues, so id will be empty -->
  581. <LReference>
  582. <xsl:if test="@name">
  583. <rdsCM:id>
  584. <xsl:value-of select="@name"/>
  585. </rdsCM:id>
  586. </xsl:if>
  587. <posId>
  588. <xsl:choose>
  589. <xsl:when test="$countType &gt; 1">
  590. <xsl:value-of select="concat($posId,'/TOCEntry[',$index,']')"/>
  591. </xsl:when>
  592. <xsl:otherwise>
  593. <xsl:value-of select="concat($posId,'/TOCEntry')"/>
  594. </xsl:otherwise>
  595. </xsl:choose>
  596. </posId>
  597. </LReference>
  598. </item>
  599. </xsl:template>
  600. <xsl:template match="fieldset">
  601. <xsl:param name="posId"/>
  602. <xsl:variable name="countType">
  603. <xsl:value-of select="count(../fieldset)"/>
  604. </xsl:variable>
  605. <xsl:variable name="index">
  606. <xsl:value-of select="1 + count(preceding-sibling::fieldset)"/>
  607. </xsl:variable>
  608. <xsl:apply-templates select="contents/*"/>
  609. </xsl:template>
  610. <xsl:template match="conditionalBlocks">
  611. <xsl:param name="posId"/>
  612. <xsl:variable name="countType">
  613. <xsl:value-of select="count(../conditionalBlocks)"/>
  614. </xsl:variable>
  615. <xsl:variable name="index">
  616. <xsl:value-of select="1 + count(preceding-sibling::conditionalBlocks)"/>
  617. </xsl:variable>
  618. <xsl:apply-templates select="./conditionalBlockDefault/contents/*"/>
  619. <xsl:for-each select="./conditionalBlockCases/conditionalBlock">
  620. <xsl:apply-templates select="./contents/*">
  621. <xsl:with-param name="posId">
  622. <xsl:choose>
  623. <xsl:when test="count(../conditionalBlock) &gt; 1">
  624. <xsl:value-of select="concat($posId,'/conditionalBlockCases/conditionalBlock[',1 + count(preceding-sibling::conditionalBlock),'/contents')"/>
  625. </xsl:when>
  626. <xsl:otherwise>
  627. <xsl:value-of select="concat($posId,'/conditionalBlockCases/conditionalBlock/contents')"/>
  628. </xsl:otherwise>
  629. </xsl:choose>
  630. </xsl:with-param>
  631. </xsl:apply-templates>
  632. </xsl:for-each>
  633. </xsl:template>
  634. <xsl:template match="layoutComponentRef">
  635. <xsl:param name="conditional"/>
  636. <xsl:param name="posId"/>
  637. <xsl:variable name="countType">
  638. <xsl:value-of select="count(../layoutComponentRef)"/>
  639. </xsl:variable>
  640. <xsl:variable name="index">
  641. <xsl:value-of select="1 + count(preceding-sibling::layoutComponentRef)"/>
  642. </xsl:variable>
  643. <!-- LCRs will be handled in a future release -->
  644. </xsl:template>
  645. <xsl:template match="CMMMap">
  646. <xsl:param name="posId"/>
  647. <xsl:variable name="countType">
  648. <xsl:value-of select="count(../CMMMap)"/>
  649. </xsl:variable>
  650. <xsl:variable name="index">
  651. <xsl:value-of select="1 + count(preceding-sibling::CMMMap)"/>
  652. </xsl:variable>
  653. <item>
  654. <LReference>
  655. <xsl:if test="@cmmID">
  656. <rdsCM:id>
  657. <xsl:value-of select="@cmmID"/>
  658. </rdsCM:id>
  659. </xsl:if>
  660. <posId>
  661. <xsl:choose>
  662. <xsl:when test="$countType &gt; 1">
  663. <xsl:value-of select="concat($posId,'/CMMMap[',$index,']')"/>
  664. </xsl:when>
  665. <xsl:otherwise>
  666. <xsl:value-of select="concat($posId,'/CMMMap')"/>
  667. </xsl:otherwise>
  668. </xsl:choose>
  669. </posId>
  670. </LReference>
  671. </item>
  672. </xsl:template>
  673. <xsl:template match="asOfTime">
  674. <!--Not yet handled-->
  675. </xsl:template>
  676. <xsl:template match="pieChart | paretoChart | scatterChart | polarChart | radarChart | progressiveChart | combinationChart | bubbleChart | threeDCombinationChart | threeDScatterChart | gaugeChart | mapChart | metricsChart | marimekkoChart | winLossChart | v2_combinationChart | v2_scatterChart | v2_pieChart | v2_gaugeChart | v2_matrixChart | v2_progressiveChart | v2_paretoChart | v2_bubbleChart | v2_repeaterChart | v2_bulletChart">
  677. <xsl:param name="posId"/>
  678. <item>
  679. <LReference>
  680. <xsl:if test="@name">
  681. <rdsCM:id>
  682. <xsl:value-of select="@name"/>
  683. </rdsCM:id>
  684. </xsl:if>
  685. <posId>
  686. <xsl:choose>
  687. <xsl:when test="name() = 'pieChart'">
  688. <xsl:choose>
  689. <xsl:when test="count(../pieChart) &gt; 1">
  690. <xsl:value-of select="concat($posId,'/pieChart[',1 + count(preceding-sibling::pieChart),']')"/>
  691. </xsl:when>
  692. <xsl:otherwise>
  693. <xsl:value-of select="concat($posId,'/pieChart')"/>
  694. </xsl:otherwise>
  695. </xsl:choose>
  696. </xsl:when>
  697. <xsl:when test="name() = 'paretoChart'">
  698. <xsl:choose>
  699. <xsl:when test="count(../paretoChart) &gt; 1">
  700. <xsl:value-of select="concat($posId,'/paretoChart[',1 + count(preceding-sibling::paretoChart),']')"/>
  701. </xsl:when>
  702. <xsl:otherwise>
  703. <xsl:value-of select="concat($posId,'/paretoChart')"/>
  704. </xsl:otherwise>
  705. </xsl:choose>
  706. </xsl:when>
  707. <xsl:when test="name() = 'scatterChart'">
  708. <xsl:choose>
  709. <xsl:when test="count(../scatterChart) &gt; 1">
  710. <xsl:value-of select="concat($posId,'/scatterChart[',1 + count(preceding-sibling::scatterChart),']')"/>
  711. </xsl:when>
  712. <xsl:otherwise>
  713. <xsl:value-of select="concat($posId,'/scatterChart')"/>
  714. </xsl:otherwise>
  715. </xsl:choose>
  716. </xsl:when>
  717. <xsl:when test="name() = 'polarChart'">
  718. <xsl:choose>
  719. <xsl:when test="count(../polarChart) &gt; 1">
  720. <xsl:value-of select="concat($posId,'/polarChart[',1 + count(preceding-sibling::polarChart),']')"/>
  721. </xsl:when>
  722. <xsl:otherwise>
  723. <xsl:value-of select="concat($posId,'/polarChart')"/>
  724. </xsl:otherwise>
  725. </xsl:choose>
  726. </xsl:when>
  727. <xsl:when test="name() = 'radarChart'">
  728. <xsl:choose>
  729. <xsl:when test="count(../radarChart) &gt; 1">
  730. <xsl:value-of select="concat($posId,'/radarChart[',1 + count(preceding-sibling::radarChart),']')"/>
  731. </xsl:when>
  732. <xsl:otherwise>
  733. <xsl:value-of select="concat($posId,'/radarChart')"/>
  734. </xsl:otherwise>
  735. </xsl:choose>
  736. </xsl:when>
  737. <xsl:when test="name() = 'progressiveChart'">
  738. <xsl:choose>
  739. <xsl:when test="count(../progressiveChart) &gt; 1">
  740. <xsl:value-of select="concat($posId,'/progressiveChart[',1 + count(preceding-sibling::progressiveChart),']')"/>
  741. </xsl:when>
  742. <xsl:otherwise>
  743. <xsl:value-of select="concat($posId,'/progressiveChart')"/>
  744. </xsl:otherwise>
  745. </xsl:choose>
  746. </xsl:when>
  747. <xsl:when test="name() = 'combinationChart'">
  748. <xsl:choose>
  749. <xsl:when test="count(../combinationChart) &gt; 1">
  750. <xsl:value-of select="concat($posId,'/combinationChart[',1 + count(preceding-sibling::combinationChart),']')"/>
  751. </xsl:when>
  752. <xsl:otherwise>
  753. <xsl:value-of select="concat($posId,'/combinationChart')"/>
  754. </xsl:otherwise>
  755. </xsl:choose>
  756. </xsl:when>
  757. <xsl:when test="name() = 'bubbleChart'">
  758. <xsl:choose>
  759. <xsl:when test="count(../bubbleChart) &gt; 1">
  760. <xsl:value-of select="concat($posId,'/bubbleChart[',1 + count(preceding-sibling::bubbleChart),']')"/>
  761. </xsl:when>
  762. <xsl:otherwise>
  763. <xsl:value-of select="concat($posId,'/bubbleChart')"/>
  764. </xsl:otherwise>
  765. </xsl:choose>
  766. </xsl:when>
  767. <xsl:when test="name() = 'threeDCombinationChart'">
  768. <xsl:choose>
  769. <xsl:when test="count(../threeDCombinationChart) &gt; 1">
  770. <xsl:value-of select="concat($posId,'/threeDCombinationChart[',1 + count(preceding-sibling::threeDCombinationChart),']')"/>
  771. </xsl:when>
  772. <xsl:otherwise>
  773. <xsl:value-of select="concat($posId,'/threeDCombinationChart')"/>
  774. </xsl:otherwise>
  775. </xsl:choose>
  776. </xsl:when>
  777. <xsl:when test="name() = 'threeDScatterChart'">
  778. <xsl:choose>
  779. <xsl:when test="count(../threeDScatterChart) &gt; 1">
  780. <xsl:value-of select="concat($posId,'/threeDScatterChart[',1 + count(preceding-sibling::threeDScatterChart),']')"/>
  781. </xsl:when>
  782. <xsl:otherwise>
  783. <xsl:value-of select="concat($posId,'/threeDScatterChart')"/>
  784. </xsl:otherwise>
  785. </xsl:choose>
  786. </xsl:when>
  787. <xsl:when test="name() = 'gaugeChart'">
  788. <xsl:choose>
  789. <xsl:when test="count(../gaugeChart) &gt; 1">
  790. <xsl:value-of select="concat($posId,'/gaugeChart[',1 + count(preceding-sibling::gaugeChart),']')"/>
  791. </xsl:when>
  792. <xsl:otherwise>
  793. <xsl:value-of select="concat($posId,'/gaugeChart')"/>
  794. </xsl:otherwise>
  795. </xsl:choose>
  796. </xsl:when>
  797. <xsl:when test="name() = 'mapChart'">
  798. <xsl:choose>
  799. <xsl:when test="count(../mapChart) &gt; 1">
  800. <xsl:value-of select="concat($posId,'/mapChart[',1 + count(preceding-sibling::mapChart),']')"/>
  801. </xsl:when>
  802. <xsl:otherwise>
  803. <xsl:value-of select="concat($posId,'/mapChart')"/>
  804. </xsl:otherwise>
  805. </xsl:choose>
  806. </xsl:when>
  807. <xsl:when test="name() = 'metricsChart'">
  808. <xsl:choose>
  809. <xsl:when test="count(../metricsChart) &gt; 1">
  810. <xsl:value-of select="concat($posId,'/metricsChart[',1 + count(preceding-sibling::metricsChart),']')"/>
  811. </xsl:when>
  812. <xsl:otherwise>
  813. <xsl:value-of select="concat($posId,'/metricsChart')"/>
  814. </xsl:otherwise>
  815. </xsl:choose>
  816. </xsl:when>
  817. <xsl:when test="name() = 'marimekkoChart'">
  818. <xsl:choose>
  819. <xsl:when test="count(../marimekkoChart) &gt; 1">
  820. <xsl:value-of select="concat($posId,'/marimekkoChart[',1 + count(preceding-sibling::marimekkoChart),']')"/>
  821. </xsl:when>
  822. <xsl:otherwise>
  823. <xsl:value-of select="concat($posId,'/marimekkoChart')"/>
  824. </xsl:otherwise>
  825. </xsl:choose>
  826. </xsl:when>
  827. <xsl:when test="name() = 'winLossChart'">
  828. <xsl:choose>
  829. <xsl:when test="count(../winLossChart) &gt; 1">
  830. <xsl:value-of select="concat($posId,'/winLossChart[',1 + count(preceding-sibling::winLossChart),']')"/>
  831. </xsl:when>
  832. <xsl:otherwise>
  833. <xsl:value-of select="concat($posId,'/winLossChart')"/>
  834. </xsl:otherwise>
  835. </xsl:choose>
  836. </xsl:when>
  837. <xsl:when test="name() = 'winLossChart'">
  838. <xsl:choose>
  839. <xsl:when test="count(../winLossChart) &gt; 1">
  840. <xsl:value-of select="concat($posId,'/winLossChart[',1 + count(preceding-sibling::winLossChart),']')"/>
  841. </xsl:when>
  842. <xsl:otherwise>
  843. <xsl:value-of select="concat($posId,'/winLossChart')"/>
  844. </xsl:otherwise>
  845. </xsl:choose>
  846. </xsl:when>
  847. <xsl:when test="name() = 'v2_combinationChart'">
  848. <xsl:choose>
  849. <xsl:when test="count(../v2_combinationChart) &gt; 1">
  850. <xsl:value-of select="concat($posId,'/winLossChart[',1 + count(preceding-sibling::v2_combinationChart),']')"/>
  851. </xsl:when>
  852. <xsl:otherwise>
  853. <xsl:value-of select="concat($posId,'/v2_combinationChart')"/>
  854. </xsl:otherwise>
  855. </xsl:choose>
  856. </xsl:when>
  857. <xsl:when test="name() = 'v2_scatterChart'">
  858. <xsl:choose>
  859. <xsl:when test="count(../v2_scatterChart) &gt; 1">
  860. <xsl:value-of select="concat($posId,'/v2_scatterChart[',1 + count(preceding-sibling::v2_scatterChart),']')"/>
  861. </xsl:when>
  862. <xsl:otherwise>
  863. <xsl:value-of select="concat($posId,'/v2_schatterChart')"/>
  864. </xsl:otherwise>
  865. </xsl:choose>
  866. </xsl:when>
  867. <xsl:when test="name() = 'v2_pieChart'">
  868. <xsl:choose>
  869. <xsl:when test="count(../v2_combinationChart) &gt; 1">
  870. <xsl:value-of select="concat($posId,'/pieChart[',1 + count(preceding-sibling::v2_pieChart),']')"/>
  871. </xsl:when>
  872. <xsl:otherwise>
  873. <xsl:value-of select="concat($posId,'/v2_pieChart')"/>
  874. </xsl:otherwise>
  875. </xsl:choose>
  876. </xsl:when>
  877. <xsl:when test="name() = 'v2_guageChart'">
  878. <xsl:choose>
  879. <xsl:when test="count(../v2_guageChart) &gt; 1">
  880. <xsl:value-of select="concat($posId,'/v2_guageChart[',1 + count(preceding-sibling::v2_guageChart),']')"/>
  881. </xsl:when>
  882. <xsl:otherwise>
  883. <xsl:value-of select="concat($posId,'/v2_guageChart')"/>
  884. </xsl:otherwise>
  885. </xsl:choose>
  886. </xsl:when>
  887. <xsl:when test="name() = 'v2_matrixChart'">
  888. <xsl:choose>
  889. <xsl:when test="count(../v2_matrixChart) &gt; 1">
  890. <xsl:value-of select="concat($posId,'/v2_matrixChart[',1 + count(preceding-sibling::v2_matrixChart),']')"/>
  891. </xsl:when>
  892. <xsl:otherwise>
  893. <xsl:value-of select="concat($posId,'/v2_matrixChart')"/>
  894. </xsl:otherwise>
  895. </xsl:choose>
  896. </xsl:when>
  897. <xsl:when test="name() = 'v2_progressiveChart'">
  898. <xsl:choose>
  899. <xsl:when test="count(../v2_progressiveChart) &gt; 1">
  900. <xsl:value-of select="concat($posId,'/v2_progressiveChart[',1 + count(preceding-sibling::v2_progressiveChart),']')"/>
  901. </xsl:when>
  902. <xsl:otherwise>
  903. <xsl:value-of select="concat($posId,'/v2_progressiveChart')"/>
  904. </xsl:otherwise>
  905. </xsl:choose>
  906. </xsl:when>
  907. <xsl:when test="name() = 'v2_paretoChart'">
  908. <xsl:choose>
  909. <xsl:when test="count(../v2_paretoChart) &gt; 1">
  910. <xsl:value-of select="concat($posId,'/v2_paretoChart[',1 + count(preceding-sibling::v2_paretoChart),']')"/>
  911. </xsl:when>
  912. <xsl:otherwise>
  913. <xsl:value-of select="concat($posId,'/v2_paretoChart')"/>
  914. </xsl:otherwise>
  915. </xsl:choose>
  916. </xsl:when>
  917. <xsl:when test="name() = 'v2_bubbleChart'">
  918. <xsl:choose>
  919. <xsl:when test="count(../v2_bubbleChart) &gt; 1">
  920. <xsl:value-of select="concat($posId,'/v2_bubbleChart[',1 + count(preceding-sibling::v2_bubbleChart),']')"/>
  921. </xsl:when>
  922. <xsl:otherwise>
  923. <xsl:value-of select="concat($posId,'/v2_bubbleChart')"/>
  924. </xsl:otherwise>
  925. </xsl:choose>
  926. </xsl:when>
  927. <xsl:when test="name() = 'v2_repeaterChart'">
  928. <xsl:choose>
  929. <xsl:when test="count(../v2_repeaterChart) &gt; 1">
  930. <xsl:value-of select="concat($posId,'/v2_repeaterChart[',1 + count(preceding-sibling::v2_repeaterChart),']')"/>
  931. </xsl:when>
  932. <xsl:otherwise>
  933. <xsl:value-of select="concat($posId,'/v2_repeaterChart')"/>
  934. </xsl:otherwise>
  935. </xsl:choose>
  936. </xsl:when>
  937. <xsl:when test="name() = 'v2_bulletChart'">
  938. <xsl:choose>
  939. <xsl:when test="count(../v2_bulletrChart) &gt; 1">
  940. <xsl:value-of select="concat($posId,'/v2_bulletChart[',1 + count(preceding-sibling::v2_repeaterChart),']')"/>
  941. </xsl:when>
  942. <xsl:otherwise>
  943. <xsl:value-of select="concat($posId,'/v2_bulletChart')"/>
  944. </xsl:otherwise>
  945. </xsl:choose>
  946. </xsl:when>
  947. <xsl:otherwise>
  948. <xsl:value-of select="concat($posId,'/unknownChartType')"/>
  949. </xsl:otherwise>
  950. </xsl:choose>
  951. </posId>
  952. </LReference>
  953. </item>
  954. </xsl:template>
  955. <xsl:template match="defaultStyle">
  956. <RefStyle>
  957. <xsl:value-of select="@refStyle"/>
  958. </RefStyle>
  959. </xsl:template>
  960. <xsl:template match="classStyle">
  961. <ClassStyle>
  962. <Name>
  963. <xsl:value-of select="@name"/>
  964. </Name>
  965. <Value>
  966. <xsl:value-of select="CSS/@value"/>
  967. </Value>
  968. </ClassStyle>
  969. </xsl:template>
  970. </xsl:stylesheet>