transformToCMFormatedEntries.xslt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. 2011
  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"
  9. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  11. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  12. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  13. exclude-result-prefixes="xsl xsi xts xtsext">
  14. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  15. <xsl:template match="/root/wholeEntries">
  16. <xsl:for-each select="*">
  17. <xsl:variable name="current" select="."/>
  18. <xsl:variable name="rolapCubeType" select="local-name()"/>
  19. <xsl:variable name="params" select="/root/paramsMetadata/parameter[contains(concat(' ', 'baseROLAPCubeConfiguration', ' ', $rolapCubeType, ' '), concat(' ', @objectDependency, ' '))]"/>
  20. <xsl:element name="{$rolapCubeType}">
  21. <xsl:for-each select="$params">
  22. <xsl:variable name="paramName" select="@name"/>
  23. <xsl:element name="{$paramName}">
  24. <xsl:attribute name="xsi:type">
  25. <xsl:value-of select="@type"/>
  26. </xsl:attribute>
  27. <xsl:variable name="paramValue" select="$current/*[local-name()=$paramName] "/>
  28. <xsl:choose>
  29. <xsl:when test="$paramValue != ''">
  30. <xsl:value-of select="$paramValue"/>
  31. </xsl:when>
  32. <xsl:otherwise>
  33. <xsl:value-of select="@default"/>
  34. </xsl:otherwise>
  35. </xsl:choose>
  36. </xsl:element>
  37. </xsl:for-each>
  38. </xsl:element>
  39. </xsl:for-each>
  40. </xsl:template>
  41. </xsl:stylesheet>