group-parameters.xslt 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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, 2011
  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 version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  14. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  15. exclude-result-prefixes="xsl cm xts">
  16. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  17. <xsl:template match="/">
  18. <xsl:apply-templates/>
  19. </xsl:template>
  20. <!-- Separate standard parameters from credential parameters -->
  21. <xsl:template match="*[local-name()='parameters']">
  22. <xsl:if test="*[local-name()='parameterValue'][not(starts-with(*[local-name()='name'], 'credential:'))]">
  23. <parameters>
  24. <!-- Simply copy all the non-credential parameters -->
  25. <xsl:apply-templates select="*[local-name()='parameterValue'][not(starts-with(*[local-name()='name'], 'credential:'))]" mode="copy"/>
  26. </parameters>
  27. </xsl:if>
  28. <!-- if we have credential parameters -->
  29. <xsl:if test="*[local-name()='parameterValue'][starts-with(*[local-name()='name'], 'credential:')]">
  30. <credentialParameters>
  31. <xsl:value-of select="*[local-name()='parameterValue'][starts-with(*[local-name()='name'], 'credential:')]/*/*[local-name()='display']" disable-output-escaping="yes"/>
  32. </credentialParameters>
  33. </xsl:if>
  34. </xsl:template>
  35. <!-- XSLTC workaround: For some reason, I cannot copy the nodes directly without getting an ArrayIndexOutOfBoundsException -->
  36. <xsl:template match="*" mode="copy">
  37. <xsl:copy>
  38. <xsl:copy-of select="@*|text()"/>
  39. <xsl:apply-templates select="*" mode="copy"/>
  40. </xsl:copy>
  41. </xsl:template>
  42. <xsl:template match="*">
  43. <xsl:apply-templates/>
  44. </xsl:template>
  45. <xsl:template match="text()"/>
  46. </xsl:stylesheet>