uiobjects_search.xslt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:nox="http://developer.cognos.com/schemas/navomx/1/" exclude-result-prefixes="xtsext xts xsl">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:template match="/">
  15. <xsl:element name="xts:block">
  16. <xsl:copy-of select="xts:block/@*"/>
  17. <xsl:copy>
  18. <xsl:apply-templates select="xts:block/nox:uiMetadata/nox:searchSets"/>
  19. </xsl:copy>
  20. </xsl:element>
  21. </xsl:template>
  22. <xsl:template match="node()|@*">
  23. <xsl:copy>
  24. <xsl:apply-templates select="node()|@*"/>
  25. </xsl:copy>
  26. </xsl:template>
  27. <xsl:template match="nox:idsString">
  28. <xsl:copy>
  29. <xsl:apply-templates select="@*"/>
  30. <xsl:element name="xts:string">
  31. <xsl:attribute name="id"><xsl:value-of select="."/></xsl:attribute>
  32. </xsl:element>
  33. </xsl:copy>
  34. </xsl:template>
  35. <xsl:template match="nox:item">
  36. <xsl:choose>
  37. <xsl:when test="nox:classes != ''">
  38. <xsl:copy>
  39. <xsl:apply-templates select="node()|@*"/>
  40. </xsl:copy>
  41. </xsl:when>
  42. <xsl:otherwise>
  43. <!--No classes defined, default to the itemType-->
  44. <xsl:copy>
  45. <xsl:apply-templates select="node()|@*"/>
  46. <nox:classes>
  47. <nox:class><xsl:value-of select="nox:itemType"/></nox:class>
  48. </nox:classes>
  49. </xsl:copy>
  50. </xsl:otherwise>
  51. </xsl:choose>
  52. </xsl:template>
  53. <xsl:template match="nox:item[not(nox:idsString)]">
  54. <xsl:variable name="type" select="nox:itemType"/>
  55. <xsl:variable name="itemRef" select="//nox:itemRefs/nox:itemRef[nox:itemType=$type]"/>
  56. <nox:item>
  57. <xsl:if test="$itemRef/@isIndexed='true'">
  58. <xsl:attribute name="isIndexed">true</xsl:attribute>
  59. </xsl:if>
  60. <xsl:if test="@default='true'">
  61. <xsl:attribute name="default">true</xsl:attribute>
  62. </xsl:if>
  63. <xsl:apply-templates select="$itemRef/*"/>
  64. </nox:item>
  65. </xsl:template>
  66. </xsl:stylesheet>