pre-process.xslt 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2015
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:cm2="http://developer.cognos.com/schemas/contentManagerService/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xtscm">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  14. <!--
  15. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. process the xts syntax to the new Content Manager SOAP call
  17. -->
  18. <xsl:template match="xtscm:query" priority="2">
  19. <cm:query>
  20. <xsl:apply-templates/>
  21. </cm:query>
  22. </xsl:template>
  23. <xsl:template match="xtscm:add" priority="2">
  24. <cm:add>
  25. <xsl:apply-templates/>
  26. </cm:add>
  27. </xsl:template>
  28. <xsl:template match="xtscm:update" priority="2">
  29. <cm:update>
  30. <xsl:apply-templates/>
  31. </cm:update>
  32. </xsl:template>
  33. <xsl:template match="xtscm:updateDrillPath" priority="2">
  34. <rs:updateDrillPath xmlns:rs="http://developer.cognos.com/schemas/reportService/1">
  35. <cm:object xsi:type="cm:drillPath">
  36. <xsl:apply-templates mode="property"/>
  37. </cm:object>
  38. <cm:options xsi:type="cm:updateOptions">
  39. <cm:ignoreInvalidObjectReference xsi:type="xsd:boolean">false</cm:ignoreInvalidObjectReference>
  40. <cm:returnProperties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[0]"/>
  41. </cm:options>
  42. </rs:updateDrillPath>
  43. </xsl:template>
  44. <xsl:template match="xtscm:delete" priority="2">
  45. <cm:delete>
  46. <xsl:apply-templates/>
  47. </cm:delete>
  48. </xsl:template>
  49. <xsl:template match="xtscm:copy" priority="2">
  50. <cm:copy>
  51. <xsl:apply-templates/>
  52. </cm:copy>
  53. </xsl:template>
  54. <xsl:template match="xtscm:copyRename" priority="2">
  55. <cm:copyRename xmlns:cm="http://developer.cognos.com/schemas/contentManagerService/1">
  56. <xsl:apply-templates/>
  57. </cm:copyRename>
  58. </xsl:template>
  59. <xsl:template match="xtscm:newNames" priority="2">
  60. <xsl:variable name="newNames" select="local-name(parent::node())"/>
  61. <newNames xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:{$newNames}Request[{count(child::*)}]">
  62. <xsl:apply-templates/>
  63. </newNames>
  64. </xsl:template>
  65. <xsl:template match="xtscm:move" priority="2">
  66. <cm:move>
  67. <xsl:apply-templates/>
  68. </cm:move>
  69. </xsl:template>
  70. <xsl:template match="xtscm:getDeploymentOptions" priority="2">
  71. <xsl:element name="cm2:{local-name()}">
  72. <archive xsi:type="xsd:string">
  73. <xsl:apply-templates select="xtscm:inputOptions/@archive"/>
  74. </archive>
  75. <options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:deploymentOption[2]">
  76. <item xsi:type="cm:deploymentOptionString">
  77. <name xsi:type="cm:deploymentOptionEnum">archiveEncryptPassword</name>
  78. <value xsi:type="xsd:string">
  79. <xsl:value-of select="xtscm:inputOptions/@archiveEncryptPassword"/>
  80. </value>
  81. </item>
  82. <item xsi:type="cm:deploymentOptionBoolean">
  83. <name xsi:type="cm:deploymentOptionEnum">upgradeArchiveOptions</name>
  84. <value xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inputOptions/@upgradeArchiveOptions"/></value>
  85. </item>
  86. </options>
  87. </xsl:element>
  88. </xsl:template>
  89. <!--
  90. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  91. handle multiple requests in the same call
  92. -->
  93. <xsl:template match="xtscm:requests" priority="2">
  94. <xsl:variable name="req" select="local-name(parent::node())"/>
  95. <requests xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:{$req}Request[{count(child::*)}]">
  96. <xsl:for-each select="child::*">
  97. <item xsi:type="cm:{$req}Request">
  98. <xsl:apply-templates/>
  99. </item>
  100. </xsl:for-each>
  101. </requests>
  102. <xsl:if test="@cacheValidator">
  103. <options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:queryMultipleOptions">
  104. <cacheValidator xsi:type="xsd:string"><xsl:value-of select="@cacheValidator"/></cacheValidator>
  105. </options>
  106. </xsl:if>
  107. </xsl:template>
  108. <!--
  109. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  110. transform all elements (don't forget the priority="2"!)
  111. -->
  112. <xsl:template match="xtscm:searchID|xtscm:targetID" priority="2">
  113. <xsl:variable name="UpdatedRequest">
  114. <newRequest xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  115. <!-- copy everything except the targetId and the searchID -->
  116. <xsl:if test="../xtscm:searchID">
  117. <!-- <search>storeID("<xsl:copy-of select="../xtscm:searchID"/>")</search> -->
  118. <search>storeID("<xsl:apply-templates/>")</search>
  119. </xsl:if>
  120. <xsl:if test="../xtscm:targetID">
  121. <target>storeID("<xsl:apply-templates/>")</target>
  122. </xsl:if>
  123. </newRequest>
  124. </xsl:variable>
  125. <xsl:apply-templates select="$UpdatedRequest/xtscm:newRequest/*"/>
  126. </xsl:template>
  127. <xsl:template match="xtscm:properties" priority="2">
  128. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[]">
  129. <xsl:apply-templates/>
  130. <xsl:if test="count(./*[local-name()='property' and @name='tenantID'])=0">
  131. <item xsi:type="cm:propEnum">tenantID</item>
  132. </xsl:if>
  133. </properties>
  134. </xsl:template>
  135. <xsl:template match="xtscm:property" priority="2">
  136. <item xsi:type="cm:propEnum">
  137. <xsl:value-of select="@name"/>
  138. </item>
  139. </xsl:template>
  140. <xsl:template match="xtscm:refProps" priority="2">
  141. <refProps xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:refProp[{count(xtscm:refProp)}]">
  142. <xsl:apply-templates/>
  143. </refProps>
  144. </xsl:template>
  145. <xsl:template match="xtscm:refProp" priority="2">
  146. <item xsi:type="cm:refProp">
  147. <refPropName xsi:type="cm:propEnum">
  148. <xsl:value-of select="@refPropName"/>
  149. </refPropName>
  150. <xsl:apply-templates/>
  151. </item>
  152. </xsl:template>
  153. <xsl:template match="xtscm:sortBy" priority="2">
  154. <sortBy xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:sort[{count(xtscm:sort)}]">
  155. <xsl:apply-templates/>
  156. </sortBy>
  157. </xsl:template>
  158. <xsl:template match="xtscm:sort" priority="2">
  159. <item xsi:type="cm:sort">
  160. <propName xsi:type="cm:propEnum">
  161. <xsl:value-of select="@name"/>
  162. </propName>
  163. <xsl:if test="@order!=''">
  164. <order xsi:type="cm:orderEnum">
  165. <xsl:value-of select="@order"/>
  166. </order>
  167. </xsl:if>
  168. </item>
  169. </xsl:template>
  170. <xsl:template match="xtscm:options" priority="2">
  171. <xsl:call-template name="convert">
  172. <xsl:with-param name="xsi-type">
  173. <xsl:text>cm:</xsl:text>
  174. <xsl:value-of select="local-name(parent::node())"/>
  175. <xsl:text>Options</xsl:text>
  176. </xsl:with-param>
  177. </xsl:call-template>
  178. </xsl:template>
  179. <xsl:template match="xtscm:objects" priority="2">
  180. <objects xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[{count(child::*)}]">
  181. <xsl:for-each select="child::*">
  182. <item xsi:type="cm:{local-name()}">
  183. <xsl:apply-templates mode="property"/>
  184. </item>
  185. </xsl:for-each>
  186. </objects>
  187. </xsl:template>
  188. <xsl:template match="xtscm:tokenvalue" priority="2">
  189. <item xsi:type="cm:multilingualToken">
  190. <locale xsi:type="xsd:string">
  191. <xsl:value-of select="@locale"/>
  192. </locale>
  193. <value xsi:type="xsd:string">
  194. <xsl:apply-templates/>
  195. </value>
  196. </item>
  197. </xsl:template>
  198. <xsl:template match="xtscm:value" priority="2">
  199. <item xsi:type="cm:multilingualString">
  200. <locale xsi:type="xsd:string">
  201. <xsl:value-of select="@locale"/>
  202. </locale>
  203. <value xsi:type="xsd:string">
  204. <xsl:apply-templates/>
  205. </value>
  206. </item>
  207. </xsl:template>
  208. <!-- handle all "baseClass" templates -->
  209. <xsl:template match="xtscm:searchPath" mode="baseClass">
  210. <xsl:apply-templates select="self::node()" mode="property"/>
  211. </xsl:template>
  212. <xsl:template match="xtscm:searchID" mode="baseClass">
  213. <xsl:variable name="newXML">
  214. <xtscm:searchPath>storeID("<xsl:apply-templates mode="property"/>")</xtscm:searchPath>
  215. </xsl:variable>
  216. <xsl:apply-templates select="$newXML" mode="property"/>
  217. </xsl:template>
  218. <xsl:template match="xtscm:*" mode="baseClass">
  219. <item xsi:type="cm:nil">
  220. <xsl:apply-templates mode="baseClass"/>
  221. </item>
  222. </xsl:template>
  223. <!-- handle all "powerPlayOption" templates -->
  224. <xsl:template match="xtscm:name" mode="powerPlayOptions">
  225. <name xsi:type="cm:powerPlayOptionEnum">
  226. <xsl:apply-templates mode="powerPlayOptions"/>
  227. </name>
  228. </xsl:template>
  229. <xsl:template match="xtscm:value[@type='boolean']" mode="powerPlayOptions">
  230. <value xsi:type="xsd:{@type}">
  231. <xsl:apply-templates mode="powerPlayOptions"/>
  232. </value>
  233. </xsl:template>
  234. <xsl:template match="xtscm:value[@type!='boolean']" mode="powerPlayOptions">
  235. <value xsi:type="cm:{@type}">
  236. <xsl:apply-templates mode="powerPlayOptions"/>
  237. </value>
  238. </xsl:template>
  239. <xsl:template match="xtscm:powerPlayOption" mode="powerPlayOptions">
  240. <item xsi:type="cm:{@class}">
  241. <xsl:apply-templates mode="powerPlayOptions"/>
  242. </item>
  243. </xsl:template>
  244. <!-- handle the dataBlock templates -->
  245. <xsl:template match="xtscm:dataBlock" mode="dataBlock">
  246. <item xsi:type="cm:powerPlayDataBlock">
  247. <xsl:apply-templates mode="dataBlockItem"/>
  248. </item>
  249. </xsl:template>
  250. <xsl:template match="xtscm:id" mode="dataBlockItem">
  251. <id xsi:type="cm:powerPlayDataBlockEnum"><xsl:value-of select="."/></id>
  252. </xsl:template>
  253. <xsl:template match="xtscm:data" mode="dataBlockItem">
  254. <data xsi:type="xsd:base64Binary"><xsl:value-of select="."/></data>
  255. </xsl:template>
  256. <!-- handle all "RunOptions" templates -->
  257. <xsl:template match="xtscm:name" mode="runOptions">
  258. <xsl:variable name="enumClass">
  259. <xsl:choose>
  260. <xsl:when test="parent::node()[local-name()='deliveryOption']">
  261. <xsl:text>cm:deliveryOptionEnum</xsl:text>
  262. </xsl:when>
  263. <xsl:otherwise><xsl:text>cm:runOptionEnum</xsl:text></xsl:otherwise>
  264. </xsl:choose>
  265. </xsl:variable>
  266. <name>
  267. <xsl:attribute name="type" namespace="http://www.w3.org/2001/XMLSchema-instance"><xsl:value-of select="$enumClass"/></xsl:attribute>
  268. <xsl:apply-templates mode="runOptions"/>
  269. </name>
  270. </xsl:template>
  271. <xsl:template match="xtscm:value" mode="runOptions">
  272. <xsl:variable name="valueType">
  273. <xsl:choose>
  274. <xsl:when test="contains(@type, ':')">
  275. <xsl:value-of select="@type"/>
  276. </xsl:when>
  277. <xsl:otherwise>
  278. <xsl:value-of select="concat('xsd:', @type)"/>
  279. </xsl:otherwise>
  280. </xsl:choose>
  281. </xsl:variable>
  282. <value xsi:type="{$valueType}">
  283. <xsl:apply-templates mode="runOptions"/>
  284. </value>
  285. </xsl:template>
  286. <xsl:template match="xtscm:locale" mode="runOptions">
  287. <locale xsi:type="xsd:{@type}">
  288. <xsl:apply-templates mode="runOptions"/>
  289. </locale>
  290. </xsl:template>
  291. <xsl:template match="xtscm:cmvalue" mode="runOptions">
  292. <value xsi:type="cm:{@type}">
  293. <xsl:apply-templates mode="runOptions"/>
  294. </value>
  295. </xsl:template>
  296. <xsl:template match="xtscm:items" mode="runOptions">
  297. <xsl:choose>
  298. <xsl:when test="not(@type)">
  299. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[{count(xtscm:*)}]">
  300. <xsl:apply-templates mode="runOptions"/>
  301. </value>
  302. </xsl:when>
  303. <xsl:when test="substring-before(@type, ':') != ''">
  304. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="{@type}[{count(xtscm:*)}]">
  305. <xsl:apply-templates mode="runOptions"/>
  306. </value>
  307. </xsl:when>
  308. <xsl:otherwise>
  309. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:{@type}[{count(xtscm:*)}]">
  310. <xsl:apply-templates mode="runOptions"/>
  311. </value>
  312. </xsl:otherwise>
  313. </xsl:choose>
  314. </xsl:template>
  315. <xsl:template match="xtscm:item" mode="runOptions">
  316. <xsl:choose>
  317. <xsl:when test="not(@type)">
  318. <item xsi:type="xsd:string">
  319. <xsl:apply-templates mode="runOptions"/>
  320. </item>
  321. </xsl:when>
  322. <xsl:otherwise>
  323. <item xsi:type="cm:{@type}">
  324. <xsl:apply-templates mode="runOptions"/>
  325. </item>
  326. </xsl:otherwise>
  327. </xsl:choose>
  328. </xsl:template>
  329. <xsl:template match="xtscm:contentDisposition" mode="runOptions">
  330. <contentDisposition xsi:type="cm:smtpContentDispositionEnum">
  331. <xsl:apply-templates mode="runOptions"/>
  332. </contentDisposition>
  333. </xsl:template>
  334. <xsl:template match="xtscm:text" mode="runOptions">
  335. <text xsi:type="xsd:string">
  336. <xsl:apply-templates mode="runOptions"/>
  337. </text>
  338. </xsl:template>
  339. <xsl:template match="xtscm:scopeValues" mode="scope">
  340. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:metadataModelItemName[{count(xtscm:scopeValue)}]">
  341. <xsl:apply-templates mode="scope"/>
  342. </value>
  343. </xsl:template>
  344. <xsl:template match="xtscm:scopeValue" mode="scope">
  345. <item xsi:type="cm:metadataModelItemName">
  346. <xsl:value-of select="."/>
  347. </item>
  348. </xsl:template>
  349. <xsl:template match="xtscm:property" mode="runOptions">
  350. <xsl:choose>
  351. <xsl:when test="@name='objectName'">
  352. <objectName xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:{@type}[{count(xtscm:*)}]">
  353. <xsl:apply-templates mode="runOptions"/>
  354. </objectName>
  355. </xsl:when>
  356. <xsl:when test="@name='parentSearchPath'">
  357. <parentSearchPath xsi:type="xsd:string">
  358. <xsl:apply-templates mode="runOptions"/>
  359. </parentSearchPath>
  360. </xsl:when>
  361. <xsl:otherwise>
  362. <xsl:element name="{@name}">
  363. <xsl:attribute name="xsi:type"><xsl:value-of select="concat('cm:',@type)"/></xsl:attribute>
  364. <xsl:apply-templates mode="runOptions"/>
  365. </xsl:element>
  366. </xsl:otherwise>
  367. </xsl:choose>
  368. </xsl:template>
  369. <xsl:template match="xtscm:runOption" mode="runOptions">
  370. <item xsi:type="cm:{@class}">
  371. <xsl:apply-templates mode="runOptions"/>
  372. </item>
  373. </xsl:template>
  374. <xsl:template match="xtscm:deliveryOption" mode="deliveryOptions">
  375. <xsl:choose>
  376. <xsl:when test="@cmStyle = 'true'">
  377. <xsl:copy-of select="./item"/>
  378. </xsl:when>
  379. <xsl:otherwise>
  380. <item xsi:type="cm:{@class}">
  381. <xsl:apply-templates mode="runOptions"/>
  382. </item>
  383. </xsl:otherwise>
  384. </xsl:choose>
  385. </xsl:template>
  386. <!-- handle all "policies" templates -->
  387. <xsl:template match="xtscm:policy" mode="policies">
  388. <item xsi:type="cm:policy">
  389. <xsl:apply-templates mode="policies" select="*[local-name() != 'permission']"/>
  390. <permissions xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:permission[{count( xtscm:permission )}]">
  391. <xsl:apply-templates select="xtscm:permission" mode="policies"/>
  392. </permissions>
  393. </item>
  394. </xsl:template>
  395. <!-- handle all "userCapabilityPolicies" templates -->
  396. <xsl:template match="xtscm:userCapabilityPolicy" mode="userCapabilityPolicies">
  397. <item xsi:type="cm:userCapabilityPolicy">
  398. <xsl:apply-templates mode="policies" select="*[local-name() != 'userCapabilityPermission']"/>
  399. <permissions xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:userCapabilityPermission[{count( xtscm:userCapabilityPermission )}]">
  400. <xsl:apply-templates select="xtscm:userCapabilityPermission" mode="userCapabilityPolicies"/>
  401. </permissions>
  402. </item>
  403. </xsl:template>
  404. <xsl:template match="xtscm:pageletRef">
  405. <xsl:apply-templates select="xtscm:searchPath" mode="property"/>
  406. </xsl:template>
  407. <xsl:template match="xtscm:securityObject" mode="policies">
  408. <xsl:variable name="xsiType">
  409. <xsl:choose>
  410. <xsl:when test="@type != ''">
  411. <xsl:value-of select="@type"/>
  412. </xsl:when>
  413. <xsl:otherwise>cm:nil</xsl:otherwise>
  414. </xsl:choose>
  415. </xsl:variable>
  416. <securityObject xsi:type="{$xsiType}">
  417. <xsl:apply-templates select="xtscm:searchPath" mode="property"/>
  418. </securityObject>
  419. </xsl:template>
  420. <xsl:template match="xtscm:permission" mode="policies">
  421. <item xsi:type="cm:permission">
  422. <name xsi:type="xsd:string">
  423. <xsl:value-of select="@name"/>
  424. </name>
  425. <access xsi:type="cm:accessEnum">
  426. <xsl:value-of select="@access"/>
  427. </access>
  428. </item>
  429. </xsl:template>
  430. <xsl:template match="xtscm:userCapabilityPermission" mode="userCapabilityPolicies">
  431. <item xsi:type="cm:userCapabilityPermission">
  432. <userCapability xsi:type="cm:userCapabilityEnum">
  433. <xsl:value-of select="@userCapability"/>
  434. </userCapability>
  435. <access xsi:type="cm:accessEnum">
  436. <xsl:value-of select="@access"/>
  437. </access>
  438. </item>
  439. </xsl:template>
  440. <!-- handle all "retentionRule" templates -->
  441. <xsl:template match="xtscm:retentionRule" mode="retention">
  442. <item xsi:type="cm:retentionRule">
  443. <objectClass xsi:type="cm:classEnum">
  444. <xsl:value-of select="@objectClass"/>
  445. </objectClass>
  446. <prop xsi:type="cm:propEnum">
  447. <xsl:value-of select="@prop"/>
  448. </prop>
  449. <xsl:if test="@maxDuration">
  450. <maxDuration xsi:type="xsd:duration">
  451. <xsl:value-of select="@maxDuration"/>
  452. </maxDuration>
  453. </xsl:if>
  454. <xsl:if test="@maxObjects">
  455. <maxObjects xsi:type="xsd:integer">
  456. <xsl:value-of select="@maxObjects"/>
  457. </maxObjects>
  458. </xsl:if>
  459. </item>
  460. </xsl:template>
  461. <!-- handle all "gatewayMappings" templates -->
  462. <xsl:template match="xtscm:gatewayMapping" mode="gatewayMapping">
  463. <item xsi:type="cm:gatewayMapping">
  464. <xsl:if test="@externalURI">
  465. <externalURI xsi:type="xsd:string">
  466. <xsl:value-of select="@externalURI"/>
  467. </externalURI>
  468. </xsl:if>
  469. <xsl:if test="@internalURI">
  470. <internalURI xsi:type="xsd:string">
  471. <xsl:value-of select="@internalURI"/>
  472. </internalURI>
  473. </xsl:if>
  474. </item>
  475. </xsl:template>
  476. <!-- handle all "rolapVirtualCubeConfiguration" templates -->
  477. <xsl:template match="xtscm:rolapVirtualCubeConfiguration" mode="rolapCubeConfiguration">
  478. <item xsi:type="cm:rolapVirtualCubeConfiguration">
  479. <xsl:copy-of select="*"/>
  480. </item>
  481. </xsl:template>
  482. <!-- handle all "jmxProxyHostDispatchers" templates -->
  483. <xsl:template match="xtscm:dispatcher" mode="jmxProxyHostDispatchers">
  484. <item xsi:type="cm:dispatcher">
  485. <xsl:copy-of select="*"/>
  486. </item>
  487. </xsl:template>
  488. <!-- handle all "rolapCubeConfiguration" templates -->
  489. <xsl:template match="xtscm:rolapCubeConfiguration" mode="rolapCubeConfiguration">
  490. <item xsi:type="cm:rolapCubeConfiguration">
  491. <xsl:copy-of select="*"/>
  492. </item>
  493. </xsl:template>
  494. <!-- handle all "pageDefinition" templates -->
  495. <xsl:template match="xtscm:pageDefinition" mode="pageDefinition">
  496. <xsl:if test=".!=''">
  497. <item xsi:type="cm:pageDefinition">
  498. <searchPath xsi:type="cm:stringProp">
  499. <value xsi:type="xsd:string" xml:space="preserve"><xsl:value-of select="."/></value>
  500. </searchPath>
  501. </item>
  502. </xsl:if>
  503. </xsl:template>
  504. <!-- handle all "parameters" templates -->
  505. <xsl:template match="xtscm:parameterValue" mode="parameters">
  506. <item xsi:type="cm:parameterValue">
  507. <name xsi:type="xsd:string"><xsl:value-of select="xtscm:name"/></name>
  508. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:parmValueItem[{count(*[not(self::xtscm:name)])}]">
  509. <xsl:apply-templates select="*[not(self::xtscm:name)]" mode="parameters">
  510. <xsl:with-param name="isCredential" select="starts-with(xtscm:name, 'credential:')"/>
  511. </xsl:apply-templates>
  512. </value>
  513. </item>
  514. </xsl:template>
  515. <xsl:template match="xtscm:simpleParmValueItem" mode="parameters">
  516. <xsl:param name="isCredential" select="false()"/>
  517. <item xsi:type="bus:simpleParmValueItem">
  518. <inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inclusive"/></inclusive>
  519. <xsl:choose>
  520. <xsl:when test="xtscm:display!=''">
  521. <display xsi:type="xs:string"><xsl:value-of select="xtscm:display"/></display>
  522. </xsl:when>
  523. <xsl:otherwise>
  524. <display xsi:nil="true"/>
  525. </xsl:otherwise>
  526. </xsl:choose>
  527. <xsl:choose>
  528. <xsl:when test="$isCredential">
  529. <!-- In the case of credential parameters we do not store the username and password in CM for security reasons -->
  530. <xsl:variable name="username-stripped">
  531. <xsl:choose>
  532. <xsl:when test="contains(xtscm:use, '&lt;username&gt;')">
  533. <xsl:value-of select="concat(substring-before(string(xtscm:use), '&lt;username&gt;'), '&lt;username/&gt;', substring-after(string(xtscm:use), '&lt;/username&gt;'))"/>
  534. </xsl:when>
  535. <xsl:otherwise>
  536. <xsl:value-of select="xtscm:use"/>
  537. </xsl:otherwise>
  538. </xsl:choose>
  539. </xsl:variable>
  540. <xsl:variable name="password-stripped">
  541. <xsl:choose>
  542. <xsl:when test="contains($username-stripped, '&lt;password&gt;')">
  543. <xsl:value-of select="concat(substring-before(string($username-stripped), '&lt;password&gt;'), '&lt;password/&gt;', substring-after(string($username-stripped), '&lt;/password&gt;'))"/>
  544. </xsl:when>
  545. <xsl:otherwise>
  546. <xsl:value-of select="$username-stripped"/>
  547. </xsl:otherwise>
  548. </xsl:choose>
  549. </xsl:variable>
  550. <use xsi:type="xsd:string"><xsl:value-of select="$password-stripped"/></use>
  551. </xsl:when>
  552. <xsl:otherwise>
  553. <xsl:choose>
  554. <xsl:when test="xtscm:use!=''">
  555. <use xsi:type="xs:string"><xsl:value-of select="xtscm:use"/></use>
  556. </xsl:when>
  557. <xsl:otherwise>
  558. <use xsi:nil="true"/>
  559. </xsl:otherwise>
  560. </xsl:choose>
  561. </xsl:otherwise>
  562. </xsl:choose>
  563. </item>
  564. </xsl:template>
  565. <!-- Requested by Agent -->
  566. <xsl:template match="*[contains(@xsi:type, 'parameterValue')]" mode="parameters">
  567. <xsl:copy-of select="."/>
  568. </xsl:template>
  569. <!-- -->
  570. <xsl:template match="xtscm:boundRangeParmValueItem" mode="parameters">
  571. <item xsi:type="bus:boundRangeParmValueItem">
  572. <xsl:choose>
  573. <xsl:when test="xtscm:inclusive">
  574. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inclusive"/></bus:inclusive>
  575. </xsl:when>
  576. <xsl:otherwise>
  577. <bus:inclusive xsi:type="xsd:boolean">true</bus:inclusive>
  578. </xsl:otherwise>
  579. </xsl:choose>
  580. <bus:start xsi:type="bus:simpleParmValueItem">
  581. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:start/xtscm:inclusive"/></bus:inclusive>
  582. <bus:display xsi:type="xsd:string"><xsl:value-of select="xtscm:start/xtscm:display"/></bus:display>
  583. <bus:use xsi:type="xsd:string"><xsl:value-of select="xtscm:start/xtscm:use"/></bus:use>
  584. </bus:start>
  585. <bus:end xsi:type="bus:simpleParmValueItem">
  586. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:end/xtscm:inclusive"/></bus:inclusive>
  587. <bus:display xsi:type="xsd:string"><xsl:value-of select="xtscm:end/xtscm:display"/></bus:display>
  588. <bus:use xsi:type="xsd:string"><xsl:value-of select="xtscm:end/xtscm:use"/></bus:use>
  589. </bus:end>
  590. </item>
  591. </xsl:template>
  592. <xsl:template match="xtscm:unboundedEndRangeParmValueItem" mode="parameters">
  593. <item xsi:type="bus:unboundedEndRangeParmValueItem">
  594. <xsl:choose>
  595. <xsl:when test="xtscm:inclusive">
  596. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inclusive"/></bus:inclusive>
  597. </xsl:when>
  598. <xsl:otherwise>
  599. <bus:inclusive xsi:type="xsd:boolean">true</bus:inclusive>
  600. </xsl:otherwise>
  601. </xsl:choose>
  602. <bus:start xsi:type="bus:simpleParmValueItem">
  603. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:start/xtscm:inclusive"/></bus:inclusive>
  604. <bus:display xsi:type="xsd:string"><xsl:value-of select="xtscm:start/xtscm:display"/></bus:display>
  605. <bus:use xsi:type="xsd:string"><xsl:value-of select="xtscm:start/xtscm:use"/></bus:use>
  606. </bus:start>
  607. </item>
  608. </xsl:template>
  609. <xsl:template match="xtscm:unboundedStartRangeParmValueItem" mode="parameters">
  610. <item xsi:type="bus:unboundedStartRangeParmValueItem">
  611. <xsl:choose>
  612. <xsl:when test="xtscm:inclusive">
  613. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inclusive"/></bus:inclusive>
  614. </xsl:when>
  615. <xsl:otherwise>
  616. <bus:inclusive xsi:type="xsd:boolean">true</bus:inclusive>
  617. </xsl:otherwise>
  618. </xsl:choose>
  619. <bus:end xsi:type="bus:simpleParmValueItem">
  620. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:end/xtscm:inclusive"/></bus:inclusive>
  621. <bus:display xsi:type="xsd:string"><xsl:value-of select="xtscm:end/xtscm:display"/></bus:display>
  622. <bus:use xsi:type="xsd:string"><xsl:value-of select="xtscm:end/xtscm:use"/></bus:use>
  623. </bus:end>
  624. </item>
  625. </xsl:template>
  626. <!-- Match the first hierarchicalParmValueItem -->
  627. <xsl:template match="xtscm:hierarchicalParmValueItem[parent::*[local-name() != 'hierarchicalParmValueItem']]" mode="parameters">
  628. <item xsi:type="bus:hierarchicalParmValueItem">
  629. <xsl:choose>
  630. <xsl:when test="xtscm:inclusive">
  631. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inclusive"/></bus:inclusive>
  632. </xsl:when>
  633. <xsl:otherwise>
  634. <bus:inclusive xsi:type="xsd:boolean">true</bus:inclusive>
  635. </xsl:otherwise>
  636. </xsl:choose>
  637. <value xsi:type="bus:simpleParmValueItem">
  638. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:value/xtscm:inclusive"/></bus:inclusive>
  639. <bus:display xsi:type="xsd:string"><xsl:value-of select="xtscm:value/xtscm:display"/></bus:display>
  640. <bus:use xsi:type="xsd:string"><xsl:value-of select="xtscm:value/xtscm:use"/></bus:use>
  641. </value>
  642. <xsl:apply-templates select="xtscm:hierarchicalParmValueItem" mode="parameters"/>
  643. </item>
  644. </xsl:template>
  645. <!-- Match all the sub hierarchicalParmValueItem parameters -->
  646. <xsl:template match="xtscm:hierarchicalParmValueItem[parent::*[local-name() = 'hierarchicalParmValueItem']]" mode="parameters">
  647. <subNodes xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:hierarchicalParmValueItem[{count(xtscm:hierarchicalParmValueItem)}]">
  648. <item xsi:type="bus:hierarchicalParmValueItem">
  649. <xsl:choose>
  650. <xsl:when test="xtscm:inclusive">
  651. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:inclusive"/></bus:inclusive>
  652. </xsl:when>
  653. <xsl:otherwise>
  654. <bus:inclusive xsi:type="xsd:boolean">true</bus:inclusive>
  655. </xsl:otherwise>
  656. </xsl:choose>
  657. <value xsi:type="bus:simpleParmValueItem">
  658. <bus:inclusive xsi:type="xsd:boolean"><xsl:value-of select="xtscm:value/xtscm:inclusive"/></bus:inclusive>
  659. <bus:display xsi:type="xsd:string"><xsl:value-of select="xtscm:value/xtscm:display"/></bus:display>
  660. <bus:use xsi:type="xsd:string"><xsl:value-of select="xtscm:value/xtscm:use"/></bus:use>
  661. </value>
  662. <xsl:apply-templates select="xtscm:hierarchicalParmValueItem" mode="parameters"/>
  663. </item>
  664. </subNodes>
  665. </xsl:template>
  666. <!-- handle all "parameterAssignments" templates -->
  667. <xsl:template match="xtscm:parameterAssignmentDataItem" mode ="parameterAssignments">
  668. <item xsi:type="cm:parameterAssignmentDataItem">
  669. <xsl:apply-templates mode="parameterAssignments"/>
  670. </item>
  671. </xsl:template>
  672. <xsl:template match="xtscm:parameterAssignmentExpression" mode ="parameterAssignments">
  673. <item xsi:type="cm:parameterAssignmentExpression">
  674. <xsl:apply-templates mode="parameterAssignments"/>
  675. </item>
  676. </xsl:template>
  677. <xsl:template match="xtscm:dataItemName" mode="parameterAssignments">
  678. <dataItemName xsi:type="cm:metadataModelItemName">
  679. <xsl:value-of select="text()"/>
  680. </dataItemName>
  681. </xsl:template>
  682. <xsl:template match="xtscm:expression" mode="parameterAssignments">
  683. <expression xsi:type="cm:expression">
  684. <xsl:value-of select="text()"/>
  685. </expression>
  686. </xsl:template>
  687. <xsl:template match="xtscm:parameterName" mode="parameterAssignments">
  688. <parameterName>
  689. <xsl:value-of select="text()"/>
  690. </parameterName>
  691. </xsl:template>
  692. <xsl:template match="*" mode="options">
  693. <xsl:element name="{local-name()}">
  694. <xsl:for-each select="@*">
  695. <xsl:attribute name="{name()}">
  696. <xsl:choose>
  697. <xsl:when test="starts-with(.,'cm:')"><xsl:value-of select="concat('bus:',substring-after(.,'cm:'))"/></xsl:when>
  698. <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
  699. </xsl:choose>
  700. </xsl:attribute>
  701. </xsl:for-each>
  702. <xsl:apply-templates mode="options"/>
  703. </xsl:element>
  704. </xsl:template>
  705. <!--<xsl:template match="*" mode="powerPlayServiceSpecification">
  706. <xsl:element name="{local-name()}">
  707. <xsl:for-each select="@*">
  708. <xsl:attribute name="{name()}">
  709. <xsl:value-of select="."/>
  710. </xsl:attribute>
  711. </xsl:for-each>
  712. <xsl:apply-templates mode="powerPlayServiceSpecification"/>
  713. </xsl:element>
  714. </xsl:template> -->
  715. <xsl:template match="*[(local-name()='repositoryRules' )]" mode="property">
  716. <xsl:element name="{local-name()}">
  717. <xsl:attribute name="xsi:type">cm:repositoryRule</xsl:attribute>
  718. <xsl:apply-templates select="*" mode="options"/>
  719. </xsl:element>
  720. </xsl:template>
  721. <xsl:template match="*[(local-name()='options' and namespace-uri()='') or local-name()='overrideOptions' or local-name()='serviceDefaultOptions']" mode="property">
  722. <xsl:element name="{local-name()}">
  723. <xsl:attribute name="xsi:type">cm:optionArrayProp</xsl:attribute>
  724. <xsl:apply-templates select="*" mode="options"/>
  725. </xsl:element>
  726. </xsl:template>
  727. <xsl:template match="*[local-name()='deploymentOptions']" mode="property">
  728. <xsl:element name="options">
  729. <xsl:attribute name="xsi:type">cm:optionArrayProp</xsl:attribute>
  730. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:option[{count(xtscm:deploymentOption)}]">
  731. <xsl:apply-templates mode="deploymentOptions"/>
  732. </value>
  733. <xsl:if test="count(@*) > 0">
  734. <schemaInfo>
  735. <xsl:for-each select="@*">
  736. <xsl:element name="{local-name()}">
  737. <xsl:value-of select="."/>
  738. </xsl:element>
  739. </xsl:for-each>
  740. </schemaInfo>
  741. </xsl:if>
  742. </xsl:element>
  743. </xsl:template>
  744. <xsl:template match="*[local-name()='routingTable']" mode="property">
  745. <xsl:copy-of select="."/>
  746. </xsl:template>
  747. <xsl:template match="*[local-name()='dataSourceCapabilities']" mode="property">
  748. <xsl:element name="capabilities" xsi:type="cm:anyURIArrayProp">
  749. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[{count(xtscm:capability)}]">
  750. <xsl:for-each select="xtscm:capability">
  751. <item xsi:type="xsd:string">
  752. <xsl:value-of select="."/>
  753. </item>
  754. </xsl:for-each>
  755. </value>
  756. </xsl:element>
  757. </xsl:template>
  758. <!-- handle all "property" templates, perform the special conversions, including removing the namespace -->
  759. <xsl:template match="xtscm:*" mode="property">
  760. <xsl:choose>
  761. <!-- WO 2280 abacab support powerplay8 for now we need to just drop the blob pp passes to us -->
  762. <xsl:when test="(parent::node()[@name = 'm_pp8properties'] and (local-name()='specification' or local-name()='metadataModelPackage' or local-name()='metadataModel')) or (name(..)='cm:powerPlay8Report' and local-name()='specification')">
  763. <xsl:copy-of select="."/>
  764. </xsl:when>
  765. <xsl:otherwise>
  766. <xsl:element name="{local-name()}">
  767. <xsl:choose>
  768. <!--CM DOES NOT SUPPORT MULTILINGUALSTRINGS YET -->
  769. <!--xsl:when test="local-name()='defaultName'">
  770. <xsl:attribute name="xsi:type">cm:nameProp</xsl:attribute>
  771. <value xsi:type="cm:multilingualStringProp">
  772. <locale xsi:type="xsd:string">en</locale>
  773. <value xsi:type="xsd:string">
  774. <xsl:apply-templates/>
  775. </value>
  776. </value>
  777. </xsl:when-->
  778. <xsl:when test="local-name()='members' or local-name()='tenantMembers' or local-name()='consumers' or local-name()='definition' or local-name()='base' or local-name()='stepObject' or local-name()='target' or local-name()='owner' or local-name()='contact' or local-name()='dataSourceAccessAccount' or local-name()='credentialNamespaces' or local-name()='metadataModel' or local-name()='taskObject' or local-name()='portalPages' or local-name()='portlet' or local-name()='metadataModelPackage' or local-name()='channel' or local-name()='defaultAnalysis'">
  779. <xsl:attribute name="xsi:type">cm:baseClassArrayProp</xsl:attribute>
  780. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[{count(xtscm:*)}]">
  781. <xsl:apply-templates mode="baseClass"/>
  782. </value>
  783. </xsl:when>
  784. <xsl:when test="local-name()='runOptions'">
  785. <xsl:attribute name="xsi:type">cm:runOptionArrayProp</xsl:attribute>
  786. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:runOption[{count(xtscm:*)}]">
  787. <xsl:apply-templates mode="runOptions"/>
  788. </value>
  789. </xsl:when>
  790. <xsl:when test="local-name()='options' and parent::*[local-name() = 'agentTaskDefinition']">
  791. <xsl:attribute name="xsi:type">cm:optionArrayProp</xsl:attribute>
  792. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:option[{count(*/*)}]">
  793. <xsl:apply-templates select="*/*[local-name()='runOption']" mode="runOptions"/>
  794. <xsl:apply-templates select="*/*[local-name()='deliveryOption']" mode="deliveryOptions"/>
  795. <xsl:copy-of select="*/*[local-name()='item']"/>
  796. </value>
  797. </xsl:when>
  798. <xsl:when test="local-name()='options'">
  799. <xsl:attribute name="xsi:type">cm:optionArrayProp</xsl:attribute>
  800. <xsl:apply-templates select="*" mode="options"/>
  801. </xsl:when>
  802. <xsl:when test="local-name()='dataBlocks'">
  803. <xsl:attribute name="xsi:type">cm:powerPlayDataBlockArrayProp</xsl:attribute>
  804. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:powerPlayDataBlock[{count(xtscm:dataBlock)}]">
  805. <xsl:apply-templates mode="dataBlock"/>
  806. </value>
  807. </xsl:when>
  808. <xsl:when test="local-name()='policies'">
  809. <xsl:attribute name="xsi:type">cm:policyArrayProp</xsl:attribute>
  810. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:policy[{count(xtscm:policy | .//xtscm:policy)}]">
  811. <xsl:apply-templates mode="policies"/>
  812. </value>
  813. </xsl:when>
  814. <xsl:when test="local-name()='userCapabilityPolicies'">
  815. <xsl:attribute name="xsi:type">cm:userCapabilityPolicyArrayProp</xsl:attribute>
  816. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:userCapabilityPolicy[{count(xtscm:userCapabilityPolicy)}]">
  817. <xsl:apply-templates mode="userCapabilityPolicies"/>
  818. </value>
  819. </xsl:when>
  820. <xsl:when test="local-name()='name'">
  821. <xsl:attribute name="xsi:type">cm:multilingualTokenProp</xsl:attribute>
  822. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:multilingualToken[{count(xtscm:tokenvalue)}]">
  823. <xsl:apply-templates/>
  824. </value>
  825. </xsl:when>
  826. <xsl:when test="local-name()='defaultName'">
  827. <xsl:attribute name="xsi:type">cm:tokenProp</xsl:attribute>
  828. <value xsi:type="xsd:string">
  829. <xsl:apply-templates/>
  830. </value>
  831. </xsl:when>
  832. <xsl:when test="local-name()='displaySequence'">
  833. <xsl:attribute name="xsi:type">cm:nonNegativeIntegerProp</xsl:attribute>
  834. <value xsi:type="xsd:integer">
  835. <xsl:apply-templates/>
  836. </value>
  837. </xsl:when>
  838. <xsl:when test="local-name()='description' or local-name()='screenTip' or local-name()='triggerDescription' or local-name()='title'">
  839. <xsl:attribute name="xsi:type">cm:multilingualStringProp</xsl:attribute>
  840. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:multilingualString[{count(xtscm:value)}]">
  841. <xsl:apply-templates/>
  842. </value>
  843. </xsl:when>
  844. <xsl:when test="local-name()='retentions'">
  845. <xsl:attribute name="xsi:type">cm:retentionRuleArrayProp</xsl:attribute>
  846. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:retentionRule[{count(xtscm:retentionRule)}]">
  847. <xsl:apply-templates mode="retention"/>
  848. </value>
  849. </xsl:when>
  850. <xsl:when test="local-name()='rdsGatewayMappings'">
  851. <xsl:attribute name="xsi:type">cm:gatewayMappingArrayProp</xsl:attribute>
  852. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:gatewayMapping[{count(xtscm:gatewayMapping)}]">
  853. <xsl:apply-templates mode="gatewayMapping"/>
  854. </value>
  855. </xsl:when>
  856. <xsl:when test="local-name()='qsROLAPCubeConfigurations'">
  857. <xsl:attribute name="xsi:type">cm:baseROLAPCubeConfigurationArrayProp</xsl:attribute>
  858. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseROLAPCubeConfiguration[{count(xtscm:rolapVirtualCubeConfiguration | xtscm:rolapCubeConfiguration)}]">
  859. <xsl:apply-templates mode="rolapCubeConfiguration"/>
  860. </value>
  861. </xsl:when>
  862. <xsl:when test="local-name()='jmxProxyHostDispatchers'">
  863. <xsl:attribute name="xsi:type">cm:baseClassArrayProp</xsl:attribute>
  864. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[{count(xtscm:dispatcher)}]">
  865. <xsl:apply-templates mode="jmxProxyHostDispatchers"/>
  866. </value>
  867. </xsl:when>
  868. <xsl:when test="local-name()='credentials'">
  869. <xsl:attribute name="xsi:type">cm:anyTypeProp</xsl:attribute>
  870. <value xsi:type="xsd:string">
  871. <xsl:text>&lt;credential&gt;&lt;encryptedValue&gt;</xsl:text>
  872. <xsl:value-of select="."/>
  873. <xsl:text>&lt;/encryptedValue&gt;&lt;/credential&gt;</xsl:text>
  874. </value>
  875. </xsl:when>
  876. <xsl:when test="local-name()='executionPageDefinition'">
  877. <xsl:attribute name="xsi:type">cm:baseClassArrayProp</xsl:attribute>
  878. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[{count(xtscm:pageDefinition)}]">
  879. <xsl:apply-templates mode="pageDefinition"/>
  880. </value>
  881. </xsl:when>
  882. <xsl:when test="local-name()='parameters'">
  883. <xsl:attribute name="xsi:type">cm:parameterValueArrayProp</xsl:attribute>
  884. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:parameterValue[{count(xtscm:parameterValue)}]">
  885. <xsl:apply-templates mode="parameters"/>
  886. </value>
  887. </xsl:when>
  888. <xsl:when test="local-name()='parameterAssignments'">
  889. <xsl:attribute name="xsi:type">cm:baseParameterAssignmentArrayProp</xsl:attribute>
  890. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseParameterAssignment[{count(./*)}]">
  891. <xsl:if test="count(./*)>0">
  892. <xsl:apply-templates mode="parameterAssignments"/>
  893. </xsl:if>
  894. </value>
  895. </xsl:when>
  896. <xsl:when test="local-name()='scope'">
  897. <xsl:attribute name="xsi:type">cm:metadataModelItemNameArrayProp</xsl:attribute>
  898. <xsl:apply-templates mode="scope"/>
  899. </xsl:when>
  900. <xsl:when test="local-name()='bookmarkItem' or local-name()='storedProcedureName'">
  901. <xsl:attribute name="xsi:type">cm:metadataModelItemNameProp</xsl:attribute>
  902. <value xsi:type="cm:metadataModelItemName">
  903. <xsl:apply-templates/>
  904. </value>
  905. </xsl:when>
  906. <xsl:when test="local-name()='useAccessibilityFeatures' or local-name()='allowNotification'">
  907. <xsl:attribute name="xsi:type">cm:booleanProp</xsl:attribute>
  908. <value xsi:type="xsd:boolean"><xsl:value-of select="."/></value>
  909. </xsl:when>
  910. <xsl:when test="local-name()='specification'">
  911. <xsl:choose>
  912. <xsl:when test="@type='dataIntegrationServiceSpecificationProp'">
  913. <xsl:attribute name="xsi:type">cm:dataIntegrationServiceSpecificationProp</xsl:attribute>
  914. <value xsi:type="cm:dataIntegrationServiceSpecification">
  915. <value xsi:type="cm:specification">
  916. <xsl:apply-templates/>
  917. </value>
  918. </value>
  919. </xsl:when>
  920. <xsl:when test="parent::*[local-name() = 'updateDrillPath']">
  921. <xsl:attribute name="xsi:type">cm:reportServiceDrillThroughSpecificationProp</xsl:attribute>
  922. <value xsi:type="cm:reportServiceDrillThroughSpecification">
  923. <value xsi:type="cm:specification">
  924. <xsl:value-of select="xtsext:xmldecode(string(.))"/>
  925. </value>
  926. </value>
  927. </xsl:when>
  928. <xsl:otherwise>
  929. <xsl:attribute name="xsi:type">cm:anyTypeProp</xsl:attribute>
  930. <value xsi:type="xsd:string">
  931. <xsl:apply-templates/>
  932. </value>
  933. </xsl:otherwise>
  934. </xsl:choose>
  935. </xsl:when>
  936. <xsl:when test="local-name()='closeConnectionCommands' or local-name()='closeSessionCommands' or local-name()='openConnectionCommands' or local-name()='openSessionCommands'">
  937. <xsl:attribute name="xsi:type">cm:dataSourceCommandBlockProp</xsl:attribute>
  938. <value xsi:type="cm:dataSourceCommandBlock">
  939. <xsl:apply-templates/>
  940. </value>
  941. </xsl:when>
  942. <xsl:when test="local-name()='routingHints' or local-name()='eventKey'">
  943. <xsl:attribute name="xsi:type">cm:stringArrayProp</xsl:attribute>
  944. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[{count(xtscm:item)}]">
  945. <xsl:for-each select="xtscm:item">
  946. <item xsi:type="xsd:string">
  947. <xsl:apply-templates/>
  948. </item>
  949. </xsl:for-each>
  950. </value>
  951. </xsl:when>
  952. <xsl:when test="local-name()='eventTypes'">
  953. <xsl:attribute name="xsi:type">cm:eventTypeEnumArrayProp</xsl:attribute>
  954. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:eventTypeEnum[{count(xtscm:item)}]">
  955. <xsl:for-each select="xtscm:item">
  956. <item xsi:type="cm:eventTypeEnum">
  957. <xsl:value-of select="."/>
  958. </item>
  959. </xsl:for-each>
  960. </value>
  961. </xsl:when>
  962. <xsl:when test="local-name()='sequencing'">
  963. <xsl:attribute name="xsi:type">cm:nmtokenProp</xsl:attribute>
  964. <value xsi:type="xsd:string">
  965. <xsl:apply-templates/>
  966. </value>
  967. </xsl:when>
  968. <xsl:when test="(local-name()='link' and parent::node()[local-name()='urlRSSTask']) or local-name() = 'uri'">
  969. <xsl:attribute name="xsi:type">cm:anyURIProp</xsl:attribute>
  970. <value xsi:type="xsd:string">
  971. <xsl:apply-templates/>
  972. </value>
  973. </xsl:when>
  974. <xsl:when test="local-name()='link' and parent::node()[local-name()='shortcutRSSTask']">
  975. <xsl:attribute name="xsi:type">cm:baseClassArrayProp</xsl:attribute>
  976. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:baseClass[{count(xtscm:*)}]">
  977. <xsl:apply-templates mode="baseClass"/>
  978. </value>
  979. </xsl:when>
  980. <xsl:when test="local-name()='link' and parent::node()[local-name()='shortcutAgentRSSTask']">
  981. <xsl:attribute name="xsi:type">cm:agentOutputEnumProp</xsl:attribute>
  982. <value xsi:type="cm:agentOutputEnum">
  983. <xsl:apply-templates/>
  984. </value>
  985. </xsl:when>
  986. <xsl:when test="local-name()='brsDataSourceChange' or local-name()='rsDataSourceChange'">
  987. <xsl:attribute name="xsi:type">cm:dateTimeProp</xsl:attribute>
  988. <value xsi:type="xsd:dateTime">
  989. <xsl:apply-templates/>
  990. </value>
  991. </xsl:when>
  992. <xsl:when test="local-name()='filterDataItemName'">
  993. <xsl:attribute name="xsi:type">cm:metadataModelItemNameProp</xsl:attribute>
  994. <value xsi:type="cm:metadataModelItemName">
  995. <xsl:apply-templates/>
  996. </value>
  997. </xsl:when>
  998. <xsl:when test="local-name()='runCondition'">
  999. <xsl:attribute name="xsi:type">cm:runConditionEnumProp</xsl:attribute>
  1000. <value xsi:type="cm:runConditionEnum">
  1001. <xsl:apply-templates/>
  1002. </value>
  1003. </xsl:when>
  1004. <xsl:when test="local-name()='iconURI'">
  1005. <xsl:attribute name="xsi:type">cm:anyURIProp</xsl:attribute>
  1006. <value xsi:type="xsd:string">
  1007. <xsl:apply-templates/>
  1008. </value>
  1009. </xsl:when>
  1010. <xsl:when test="local-name()='hidden'">
  1011. <xsl:attribute name="xsi:type">cm:booleanProp</xsl:attribute>
  1012. <value xsi:type="xsd:boolean">
  1013. <xsl:apply-templates/>
  1014. </value>
  1015. </xsl:when>
  1016. <xsl:when test="local-name()='disabled'">
  1017. <xsl:attribute name="xsi:type">cm:booleanProp</xsl:attribute>
  1018. <xsl:if test="string(./child::node())!=''">
  1019. <value xsi:type="xsd:boolean">
  1020. <xsl:apply-templates/>
  1021. </value>
  1022. </xsl:if>
  1023. </xsl:when>
  1024. <xsl:when test="local-name()='report'">
  1025. <xsl:attribute name="xsi:type">cm:reportDataServiceSpecificationProp</xsl:attribute>
  1026. <value xsi:type="cm:reportDataServiceSpecification">
  1027. <value xsi:type="cm:specification">
  1028. <xsl:apply-templates/>
  1029. </value>
  1030. </value>
  1031. </xsl:when>
  1032. <xsl:when test="local-name()='action'">
  1033. <xsl:attribute name="xsi:type">cm:baseReportActionEnumProp</xsl:attribute>
  1034. <value xsi:type="cm:baseReportActionEnum">
  1035. <xsl:apply-templates/>
  1036. </value>
  1037. </xsl:when>
  1038. <xsl:when test="local-name()='defaultPortalAction' and (contains(' powerPlay8Report powerPlay8ReportView ', concat(' ', local-name(parent::*), ' ')))">
  1039. <xsl:attribute name="xsi:type">cm:basePowerPlay8ReportActionEnumProp</xsl:attribute>
  1040. <value xsi:type="cm:basePowerPlay8ReportActionEnum">
  1041. <xsl:apply-templates/>
  1042. </value>
  1043. </xsl:when>
  1044. <xsl:when test="local-name()='defaultPortalAction' and (contains(' interactiveReport reportView analysis query report reportTemplate ', concat(' ', local-name(parent::*), ' ')))">
  1045. <xsl:attribute name="xsi:type">cm:baseReportActionEnumProp</xsl:attribute>
  1046. <value xsi:type="cm:baseReportActionEnum">
  1047. <xsl:apply-templates/>
  1048. </value>
  1049. </xsl:when>
  1050. <!-- handle xml tags inside a any kind of property -->
  1051. <xsl:when test="count(child::*) > 0">
  1052. <xsl:attribute name="xsi:type">cm:anyTypeProp</xsl:attribute>
  1053. <value xsi:type="xsd:string">
  1054. <xsl:variable name="encoded">
  1055. <xsl:apply-templates mode="encode" select="child::node()"/>
  1056. </xsl:variable>
  1057. <xsl:value-of select="$encoded"/>
  1058. </value>
  1059. </xsl:when>
  1060. <xsl:otherwise>
  1061. <!-- default case: a simple string property -->
  1062. <xsl:attribute name="xsi:type">cm:stringProp</xsl:attribute>
  1063. <value xsi:type="xsd:string">
  1064. <xsl:apply-templates/>
  1065. </value>
  1066. </xsl:otherwise>
  1067. </xsl:choose>
  1068. <xsl:if test="count(@*[local-name()!='type']) > 0">
  1069. <schemaInfo>
  1070. <xsl:for-each select="@*">
  1071. <!-- While we have always sent updateAllDescendents as an option, it turns out that it is not a modelled option.
  1072. The real option is applyUpdateToDescendants. RSVP is now more strict about this, so we must convert. -->
  1073. <xsl:choose>
  1074. <xsl:when test="local-name() = 'updateAllDescendents'">
  1075. <applyUpdateToDescendants>
  1076. <xsl:value-of select="."/>
  1077. </applyUpdateToDescendants>
  1078. </xsl:when>
  1079. <xsl:otherwise>
  1080. <xsl:element name="{local-name()}">
  1081. <xsl:value-of select="."/>
  1082. </xsl:element>
  1083. </xsl:otherwise>
  1084. </xsl:choose>
  1085. </xsl:for-each>
  1086. </schemaInfo>
  1087. </xsl:if>
  1088. </xsl:element>
  1089. </xsl:otherwise>
  1090. </xsl:choose>
  1091. </xsl:template>
  1092. <!-- handle all "deploymentOptions" templates, perform the special conversions, including removing the namespace -->
  1093. <xsl:template match="xtscm:deploymentOptions" mode="deploymentOptions">
  1094. <options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:option[{count(xtscm:*)}]">
  1095. <xsl:apply-templates mode="deploymentOptions"/>
  1096. </options>
  1097. </xsl:template>
  1098. <xsl:template match="xtscm:deploymentOption" mode="deploymentOptions">
  1099. <xsl:choose>
  1100. <xsl:when test="@name='package'">
  1101. <xsl:variable name="objectClass" select="local-name(../..)"/>
  1102. <xsl:choose>
  1103. <xsl:when test="$objectClass='exportDeployment'">
  1104. <xsl:apply-templates select="." mode="exportDeployment"/>
  1105. </xsl:when>
  1106. <xsl:when test="$objectClass='importDeployment'">
  1107. <xsl:apply-templates select="." mode="importDeployment"/>
  1108. </xsl:when>
  1109. </xsl:choose>
  1110. </xsl:when>
  1111. <xsl:otherwise>
  1112. <item xsi:type="{@class}">
  1113. <name xsi:type="cm:deploymentOptionEnum"><xsl:value-of select="@name"/></name>
  1114. <value>
  1115. <xsl:choose>
  1116. <xsl:when test="@class='cm:deploymentOptionString'">
  1117. <xsl:attribute name="xsi:type">xsd:string</xsl:attribute>
  1118. <xsl:apply-templates/>
  1119. </xsl:when>
  1120. <xsl:when test="@class='cm:deploymentOptionAnyType'">
  1121. <xsl:attribute name="xsi:type">xsd:string</xsl:attribute>
  1122. <xsl:apply-templates/>
  1123. </xsl:when>
  1124. <xsl:when test="@class='cm:deploymentOptionResolution'">
  1125. <xsl:attribute name="xsi:type">cm:conflictResolutionEnum</xsl:attribute>
  1126. <xsl:apply-templates/>
  1127. </xsl:when>
  1128. <xsl:when test="@class='cm:deploymentOptionMultilingualString'">
  1129. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1130. <xsl:attribute name="SOAP-ENC:arrayType">cm:multilingualString[<xsl:value-of select="count(xtscm:value)"/>]</xsl:attribute>
  1131. <xsl:apply-templates/>
  1132. </xsl:when>
  1133. <xsl:when test="@class='cm:deploymentOptionAuditLevel'">
  1134. <xsl:attribute name="xsi:type">cm:auditLevelEnum</xsl:attribute>
  1135. <xsl:apply-templates/>
  1136. </xsl:when>
  1137. <xsl:when test="@class='cm:deploymentOptionStringArray'">
  1138. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1139. <xsl:attribute name="SOAP-ENC:arrayType">xsd:string[<xsl:value-of select="count(xtscm:value)"/>]</xsl:attribute>
  1140. <xsl:for-each select="xtscm:value">
  1141. <value xsi:type="xsd:string"><xsl:value-of select="."/></value>
  1142. </xsl:for-each>
  1143. </xsl:when>
  1144. <xsl:otherwise>
  1145. <xsl:attribute name="xsi:type">xsd:boolean</xsl:attribute>
  1146. <xsl:apply-templates/>
  1147. </xsl:otherwise>
  1148. </xsl:choose>
  1149. </value>
  1150. </item>
  1151. </xsl:otherwise>
  1152. </xsl:choose>
  1153. </xsl:template>
  1154. <xsl:template match="xtscm:deploymentOption" mode="exportDeployment">
  1155. <xsl:if test="count(xtscm:packageDeploymentInfo) != 0">
  1156. <item xsi:type="cm:deploymentOptionSearchPathSingleObjectArray">
  1157. <name xsi:type="cm:deploymentOptionEnum">export</name>
  1158. <value>
  1159. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1160. <xsl:attribute name="SOAP-ENC:arrayType">
  1161. <xsl:text>cm:searchPathSingleObject[</xsl:text>
  1162. <xsl:value-of select="count(xtscm:packageDeploymentInfo)"/>
  1163. <xsl:text>]</xsl:text>
  1164. </xsl:attribute>
  1165. <xsl:apply-templates mode="exportDeployment"/>
  1166. </value>
  1167. </item>
  1168. <item xsi:type="cm:deploymentOptionImportRuleArray">
  1169. <name xsi:type="cm:deploymentOptionEnum">import</name>
  1170. <value>
  1171. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1172. <xsl:attribute name="SOAP-ENC:arrayType">
  1173. <xsl:text>cm:deploymentImportRule[</xsl:text>
  1174. <xsl:value-of select="count(xtscm:packageDeploymentInfo)"/>
  1175. <xsl:text>]</xsl:text>
  1176. </xsl:attribute>
  1177. <xsl:apply-templates mode="importDeployment"/>
  1178. </value>
  1179. </item>
  1180. </xsl:if>
  1181. </xsl:template>
  1182. <xsl:template match="xtscm:deploymentOption" mode="importDeployment">
  1183. <xsl:if test="count(xtscm:packageDeploymentInfo) != 0">
  1184. <item xsi:type="cm:deploymentOptionImportRuleArray">
  1185. <name xsi:type="cm:deploymentOptionEnum">import</name>
  1186. <value>
  1187. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1188. <xsl:attribute name="SOAP-ENC:arrayType">
  1189. <xsl:text>cm:deploymentImportRule[</xsl:text>
  1190. <xsl:value-of select="count(xtscm:packageDeploymentInfo)"/>
  1191. <xsl:text>]</xsl:text>
  1192. </xsl:attribute>
  1193. <xsl:apply-templates mode="importDeployment"/>
  1194. </value>
  1195. </item>
  1196. </xsl:if>
  1197. </xsl:template>
  1198. <xsl:template match="xtscm:packageDeploymentInfo" mode="exportDeployment">
  1199. <item xsi:type="cm:searchPathSingleObject">
  1200. <xsl:text>storeID('</xsl:text>
  1201. <xsl:value-of select="xtscm:storeID"/>
  1202. <xsl:text>')</xsl:text>
  1203. </item>
  1204. </xsl:template>
  1205. <xsl:template match="xtscm:packageDeploymentInfo" mode="importDeployment">
  1206. <item xsi:type="cm:deploymentImportRule">
  1207. <archiveSearchPath xsi:type="cm:searchPathSingleObject">
  1208. <!--xsl:text>storeID('</xsl:text-->
  1209. <xsl:value-of select="xtscm:archiveSearchPath"/>
  1210. <!--xsl:text>')</xsl:text-->
  1211. </archiveSearchPath>
  1212. <disabled xsi:type="xsd:boolean">
  1213. <xsl:choose>
  1214. <xsl:when test="xtscm:enabled='true'">false</xsl:when>
  1215. <xsl:otherwise>true</xsl:otherwise>
  1216. </xsl:choose>
  1217. </disabled>
  1218. <name>
  1219. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1220. <xsl:attribute name="SOAP-ENC:arrayType">cm:multilingualToken[<xsl:value-of select="count(xtscm:targetName/xtscm:tokenvalue)"/>]</xsl:attribute>
  1221. <xsl:apply-templates select="xtscm:targetName/xtscm:tokenvalue"/>
  1222. </name>
  1223. <parent xsi:type="cm:searchPathSingleObject">
  1224. <xsl:choose>
  1225. <xsl:when test="*[local-name()='targetLocation']=''">/content</xsl:when>
  1226. <xsl:otherwise><xsl:value-of select="*[local-name()='targetLocation']"/></xsl:otherwise>
  1227. </xsl:choose>
  1228. </parent>
  1229. </item>
  1230. </xsl:template>
  1231. <xsl:template match="xtscm:sourceName|xtscm:targetName" mode="deploymentOptions">
  1232. <xsl:element name="{local-name()}">
  1233. <xsl:attribute name="xsi:type">SOAP-ENC:Array</xsl:attribute>
  1234. <xsl:attribute name="SOAP-ENC:arrayType">cm:multilingualToken[<xsl:value-of select="count(xtscm:tokenvalue)"/>]</xsl:attribute>
  1235. <xsl:apply-templates/>
  1236. </xsl:element>
  1237. </xsl:template>
  1238. <xsl:template match="xtscm:enabled" mode="deploymentOptions">
  1239. <enabled xsi:type="xsd:boolean">
  1240. <xsl:apply-templates/>
  1241. </enabled>
  1242. </xsl:template>
  1243. <xsl:template match="xtscm:returnProperties" priority="2">
  1244. <returnProperties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[{count(./*[local-name()='property'])}]">
  1245. <xsl:for-each select="./*[local-name()='property']">
  1246. <item xsi:type="propEnum">
  1247. <xsl:value-of select="."/>
  1248. </item>
  1249. </xsl:for-each>
  1250. </returnProperties>
  1251. </xsl:template>
  1252. <!--
  1253. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1254. catch all elements, change attributes into elements for the CM namespace only.
  1255. -->
  1256. <xsl:template name="convert" match="*[namespace-uri()='http://developer.cognos.com/schemas/xts-cm/1/'] | @*[namespace-uri()='http://developer.cognos.com/schemas/xts-cm/1/']" priority="1">
  1257. <xsl:param name="context" select="."/>
  1258. <xsl:param name="xsi-type" select="''"/>
  1259. <xsl:element name="{local-name()}">
  1260. <xsl:if test="$xsi-type!=''">
  1261. <xsl:attribute name="xsi:type"><xsl:value-of select="$xsi-type"/></xsl:attribute>
  1262. </xsl:if>
  1263. <xsl:for-each select="@*">
  1264. <xsl:element name="{name()}">
  1265. <xsl:attribute name="xsi:type">
  1266. <xsl:choose>
  1267. <xsl:when test="name()='schemaInfo'">xsd:boolean</xsl:when>
  1268. <xsl:when test="name()='skipObjects'">xsd:integer</xsl:when>
  1269. <xsl:when test="name()='maxObjects'">xsd:integer</xsl:when>
  1270. <xsl:when test="name()='dataEncoding'">cm:encodingEnum</xsl:when>
  1271. <xsl:when test="name()='skipDataBytes'">xsd:integer</xsl:when>
  1272. <xsl:when test="name()='maxDataBytes'">xsd:integer</xsl:when>
  1273. <xsl:when test="name()='updateAction'">cm:updateActionEnum</xsl:when>
  1274. <xsl:when test="name()='recursive'">xsd:boolean</xsl:when>
  1275. <xsl:when test="name()='force'">xsd:boolean</xsl:when>
  1276. <xsl:otherwise>xsd:string</xsl:otherwise>
  1277. </xsl:choose>
  1278. </xsl:attribute>
  1279. <xsl:value-of select="."/>
  1280. </xsl:element>
  1281. </xsl:for-each>
  1282. <xsl:apply-templates/>
  1283. </xsl:element>
  1284. </xsl:template>
  1285. <xsl:template match="node()" priority="0">
  1286. <xsl:element name="{name()}" namespace="{namespace-uri()}">
  1287. <xsl:copy-of select="@*"/>
  1288. <xsl:apply-templates/>
  1289. </xsl:element>
  1290. </xsl:template>
  1291. <!--
  1292. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1293. generate text for root element, take care of the attribute namespaces
  1294. -->
  1295. <xsl:template match="*" mode="encode">
  1296. <xsl:text>&lt;</xsl:text>
  1297. <xsl:value-of select="name()"/>
  1298. <xsl:apply-templates select="@*" mode="sub-encode"/>
  1299. <xsl:if test="(namespace-uri() != '') and (name() = local-name()) and (namespace-uri() != namespace-uri(..))">
  1300. <xsl:text>&#32;xmlns=&quot;</xsl:text>
  1301. <xsl:value-of select="namespace-uri()"/>
  1302. <xsl:text>&quot;</xsl:text>
  1303. </xsl:if>
  1304. <xsl:if test="(contains(name(), ':')) and (namespace-uri() != namespace-uri(..))">
  1305. <xsl:text>&#32;xmlns:</xsl:text>
  1306. <xsl:value-of select="substring-before(name(), ':')"/>
  1307. <xsl:text>=&quot;</xsl:text>
  1308. <xsl:value-of select="namespace-uri()"/>
  1309. <xsl:text>&quot;</xsl:text>
  1310. </xsl:if>
  1311. <xsl:variable name="attributes" select="@* | .//@*"/>
  1312. <!--
  1313. The following line should be <xsl:for-each select="$attributes"> but it doesn't work properly in XSLTC
  1314. -->
  1315. <xsl:for-each select="@* | .//@*">
  1316. <xsl:if test="(contains(name(), ':'))">
  1317. <xsl:variable name="ns-name" select="substring-before(name(), ':')"/>
  1318. <xsl:variable name="ns-pos" select="position()"/>
  1319. <xsl:if test="not($attributes[position() &lt; $ns-pos and substring-before(name(), ':') = $ns-name])">
  1320. <xsl:text>&#32;xmlns:</xsl:text>
  1321. <xsl:value-of select="substring-before(name(), ':')"/>
  1322. <xsl:text>=&quot;</xsl:text>
  1323. <xsl:value-of select="namespace-uri()"/>
  1324. <xsl:text>&quot;</xsl:text>
  1325. </xsl:if>
  1326. </xsl:if>
  1327. </xsl:for-each>
  1328. <xsl:text>&gt;</xsl:text>
  1329. <xsl:apply-templates select="* | text()" mode="sub-encode"/>
  1330. <xsl:text>&lt;/</xsl:text>
  1331. <xsl:value-of select="name()"/>
  1332. <xsl:text>&gt;</xsl:text>
  1333. </xsl:template>
  1334. <xsl:template match="*" mode="sub-encode">
  1335. <xsl:text>&lt;</xsl:text>
  1336. <xsl:value-of select="name()"/>
  1337. <xsl:apply-templates select="@*" mode="sub-encode"/>
  1338. <xsl:if test="(namespace-uri() != '') and (name() = local-name()) and (namespace-uri() != namespace-uri(..))">
  1339. <xsl:text>&#32;xmlns=&quot;</xsl:text>
  1340. <xsl:value-of select="namespace-uri()"/>
  1341. <xsl:text>&quot;</xsl:text>
  1342. </xsl:if>
  1343. <xsl:if test="(contains(name(), ':')) and (namespace-uri() != namespace-uri(..))">
  1344. <xsl:text>&#32;xmlns:</xsl:text>
  1345. <xsl:value-of select="substring-before(name(), ':')"/>
  1346. <xsl:text>=&quot;</xsl:text>
  1347. <xsl:value-of select="namespace-uri()"/>
  1348. <xsl:text>&quot;</xsl:text>
  1349. </xsl:if>
  1350. <xsl:text>/&gt;</xsl:text>
  1351. </xsl:template>
  1352. <!-- generate text for an element with children or text -->
  1353. <xsl:template match="*[* | text()]" mode="sub-encode">
  1354. <xsl:text>&lt;</xsl:text>
  1355. <xsl:value-of select="name()"/>
  1356. <xsl:apply-templates select="@*" mode="sub-encode"/>
  1357. <xsl:if test="(namespace-uri() != '') and (name() = local-name()) and (namespace-uri() != namespace-uri(..))">
  1358. <xsl:text>&#32;xmlns=&quot;</xsl:text>
  1359. <xsl:value-of select="namespace-uri()"/>
  1360. <xsl:text>&quot;</xsl:text>
  1361. </xsl:if>
  1362. <xsl:if test="(contains(name(), ':')) and (namespace-uri() != namespace-uri(..))">
  1363. <xsl:text>&#32;xmlns:</xsl:text>
  1364. <xsl:value-of select="substring-before(name(), ':')"/>
  1365. <xsl:text>=&quot;</xsl:text>
  1366. <xsl:value-of select="namespace-uri()"/>
  1367. <xsl:text>&quot;</xsl:text>
  1368. </xsl:if>
  1369. <xsl:text>&gt;</xsl:text>
  1370. <xsl:apply-templates select="* | text()" mode="sub-encode"/>
  1371. <xsl:text>&lt;/</xsl:text>
  1372. <xsl:value-of select="name()"/>
  1373. <xsl:text>&gt;</xsl:text>
  1374. </xsl:template>
  1375. <!-- generate text for an attribute -->
  1376. <xsl:template match="@*" mode="sub-encode">
  1377. <xsl:text>&#32;</xsl:text>
  1378. <xsl:value-of select="name()"/>
  1379. <xsl:text>="</xsl:text>
  1380. <xsl:value-of select="."/>
  1381. <xsl:text>"</xsl:text>
  1382. </xsl:template>
  1383. <!-- generate text -->
  1384. <xsl:template match="text()" mode="sub-encode">
  1385. <xsl:value-of select="xtsext:xmlencode(string(.))"/>
  1386. </xsl:template>
  1387. <!--
  1388. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1389. comment() and processing-instruction() handlers
  1390. -->
  1391. <xsl:template match="comment()" priority="0">
  1392. <xsl:comment>
  1393. <xsl:value-of select="."/>
  1394. </xsl:comment>
  1395. </xsl:template>
  1396. <xsl:template match="processing-instruction()" priority="0"/>
  1397. <!--
  1398. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1399. generic text() handler
  1400. -->
  1401. <xsl:template match="text()" priority="0">
  1402. <xsl:copy-of select="."/>
  1403. </xsl:template>
  1404. </xsl:stylesheet>