targetInfoLogic.xslt 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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, 2013
  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. Transforms the infromation from getContent and getTargetInformationBlocks to have complete information
  12. required to show the path to taget in one place.
  13. -->
  14. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:pm="http://developer.cognos.com/schemas/xts/pm" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xsl send bus xts xtsext pf cm pm">
  15. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  16. <xsl:template match="/">
  17. <queryReply>
  18. <xsl:for-each select="./*[local-name()='content']/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='package']">
  19. <xsl:copy-of select="."/>
  20. </xsl:for-each>
  21. </queryReply>
  22. <queryReply>
  23. <xsl:for-each select="./*[local-name()='content']/*[local-name()='queryResponse']/*[local-name()='queryReply'][2]/*[local-name()='drillPath' or local-name()='folder' or local-name()='package']">
  24. <xsl:choose>
  25. <xsl:when test="./*[local-name()='objectClass']='folder' or ./*[local-name()='objectClass']='package'">
  26. <xsl:copy-of select="."/>
  27. </xsl:when>
  28. <xsl:when test="./*[local-name()='target']!=''">
  29. <xsl:copy-of select="."/>
  30. </xsl:when>
  31. <xsl:when test="./*[local-name()='deploymentReferences']/*[local-name()='deploymentReference']/*/*[local-name()='storeID']!=''">
  32. <drillPath>
  33. <xsl:variable name="storeID" select="./*[local-name()='deploymentReferences']/*[local-name()='deploymentReference']/*/*[local-name()='storeID']"/>
  34. <target type="cm:baseClassArrayProp" modifiable="true" searchable="false" acquirable="false" acquired="false">
  35. <xsl:copy-of select="/*[local-name()='content']/*[local-name()='targetInfo']/*[./*[local-name()='storeID' and string(.)=$storeID]][1]"/>
  36. </target>
  37. <xsl:apply-templates select="./*"/>
  38. </drillPath>
  39. </xsl:when>
  40. <xsl:otherwise>
  41. <xsl:copy-of select="."/>
  42. </xsl:otherwise>
  43. </xsl:choose>
  44. </xsl:for-each>
  45. </queryReply>
  46. </xsl:template>
  47. <xsl:template match="@*|node()">
  48. <xsl:copy>
  49. <xsl:apply-templates select="@*|node()"/>
  50. </xsl:copy>
  51. </xsl:template>
  52. <xsl:template match="cm:target">
  53. <!--We do nothing just remove the empy target which we have already replaced by a new target node-->
  54. </xsl:template>
  55. </xsl:stylesheet>