generateCMQueriesForIndexUpdateInfo.xslt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. <!--
  13. NOTE: The logic to determine the order of the queries MUST match the logic found in dt:generateInitialUIHelpers
  14. if checkUIHelpers is true, then only build the CM query if the associated UIHelper is empty.
  15. -->
  16. <xsl:stylesheet version="1.0"
  17. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  18. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  19. exclude-result-prefixes="xsl">
  20. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  21. <xsl:key name="search-paths-included-content" match="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='includedObjects']/*[local-name()='value']/*[local-name()='item']" use="."/>
  22. <xsl:key name="search-paths-excluded-content" match="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='excludedObjects']/*[local-name()='value']/*[local-name()='item']" use="."/>
  23. <xsl:template match="*[local-name()='root']" priority="1">
  24. <xsl:variable name="searchPathsInclude" select="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='includedObjects']/*[local-name()='value']/*[local-name()='item']"/>
  25. <xsl:variable name="searchPathsExclude" select="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name']='excludedObjects']/*[local-name()='value']/*[local-name()='item']"/>
  26. <!-- Included Content -->
  27. <xsl:if test="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item']/*[local-name()='name'] = 'includedObjects'">
  28. <include>
  29. <!-- loop though the set of unique searchPaths -->
  30. <xsl:for-each select="$searchPathsInclude[generate-id(.)=generate-id(key('search-paths-included-content',.))]">
  31. <cm:query>
  32. <cm:search><xsl:value-of select="."/></cm:search>
  33. <cm:properties>
  34. <cm:property name="defaultName"/>
  35. <cm:property name="searchPath"/>
  36. <cm:property name="storeID"/>
  37. <cm:property name="userInterfaces"/>
  38. <cm:property name="ancestors"/>
  39. <cm:property name="hidden"/>
  40. </cm:properties>
  41. </cm:query>
  42. </xsl:for-each>
  43. </include>
  44. </xsl:if>
  45. <!-- Excluded Content -->
  46. <xsl:if test="/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item']/*[local-name()='name'] = 'excludedObjects'">
  47. <exclude>
  48. <xsl:for-each select="$searchPathsExclude[generate-id(.)=generate-id(key('search-paths-excluded-content',.))]">
  49. <cm:query>
  50. <cm:search><xsl:value-of select="."/></cm:search>
  51. <cm:properties>
  52. <cm:property name="defaultName"/>
  53. <cm:property name="searchPath"/>
  54. <cm:property name="storeID"/>
  55. <cm:property name="userInterfaces"/>
  56. <cm:property name="ancestors"/>
  57. <cm:property name="hidden"/>
  58. </cm:properties>
  59. </cm:query>
  60. </xsl:for-each>
  61. </exclude>
  62. </xsl:if>
  63. </xsl:template>
  64. <xsl:template match="text()" priority="0"/>
  65. </xsl:stylesheet>