merge-source-default-name.xslt 1.9 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. <!--
  13. NOTE: .
  14. -->
  15. <xsl:stylesheet version="1.0"
  16. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  17. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  18. exclude-result-prefixes="xsl">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:key name="target-parent" match="/root/*[local-name() = 'queryResponse']/*[local-name() = 'queryReply']/*[local-name() = 'content' or local-name()='folder' or local-name()='package']" use="*[local-name()='searchPath']"/>
  21. <xsl:template match="/root" priority="1">
  22. <xsl:apply-templates select="*"/>
  23. </xsl:template>
  24. <xsl:template match="*[local-name()='queryResponse' or local-name()='queryReply']" priority="1">
  25. </xsl:template>
  26. <xsl:template match="*[local-name()='ancestorInfo']" priority="2">
  27. <xsl:copy>
  28. <xsl:copy-of select="node()"/>
  29. <xsl:element name="title" namespace="{namespace-uri()}">
  30. <xsl:value-of select="key('target-parent',*[local-name() = 'searchPath'])/*[local-name()='defaultName']"/>
  31. </xsl:element>
  32. <xsl:copy-of select="key('target-parent',*[local-name() = 'searchPath'])/*[local-name()='objectClass']"/>
  33. </xsl:copy>
  34. </xsl:template>
  35. <!-- match all unmatched nodes -->
  36. <xsl:template match="node()" priority="0">
  37. <xsl:copy>
  38. <xsl:copy-of select="@*"/>
  39. <xsl:apply-templates/>
  40. </xsl:copy>
  41. </xsl:template>
  42. <!-- copy just the text -->
  43. <xsl:template match="text()" priority="0">
  44. <xsl:copy-of select="."/>
  45. </xsl:template>
  46. </xsl:stylesheet>