<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed Materials - Property of IBM IBM Cognos Products: ps (C) Copyright IBM Corp. 2005, 2011 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. --> <!-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). --> <!-- NOTE: . --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/> <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']"/> <xsl:template match="/root" priority="1"> <xsl:apply-templates select="*"/> </xsl:template> <xsl:template match="*[local-name()='queryResponse' or local-name()='queryReply']" priority="1"> </xsl:template> <xsl:template match="*[local-name()='ancestorInfo']" priority="2"> <xsl:copy> <xsl:copy-of select="node()"/> <xsl:element name="title" namespace="{namespace-uri()}"> <xsl:value-of select="key('target-parent',*[local-name() = 'searchPath'])/*[local-name()='defaultName']"/> </xsl:element> <xsl:copy-of select="key('target-parent',*[local-name() = 'searchPath'])/*[local-name()='objectClass']"/> </xsl:copy> </xsl:template> <!-- match all unmatched nodes --> <xsl:template match="node()" priority="0"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <!-- copy just the text --> <xsl:template match="text()" priority="0"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>