123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?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()='ancestors']" priority="2">
- <xsl:element name="ancestors" namespace="{namespace-uri()}">
- <xsl:element name="ancestorInfo" namespace="{namespace-uri()}">
- <xsl:variable name="searchPath"><xsl:value-of select="*[local-name()='ancestorInfo']/*[local-name()='searchPath']"/></xsl:variable>
- <xsl:element name="objectClass" namespace="{namespace-uri()}">
- <xsl:value-of select="key('target-parent',$searchPath)/*[local-name()='objectClass']"/>
- </xsl:element>
- <xsl:element name="searchPath" namespace="{namespace-uri()}">
- <xsl:attribute name="type">
- <xsl:text>cm:stringProp</xsl:text>
- </xsl:attribute>
- <xsl:value-of select="key('target-parent',$searchPath)/*[local-name()='searchPath']"/>
- </xsl:element>
- <xsl:element name="storeID" namespace="{namespace-uri()}">
- <xsl:attribute name="type">
- <xsl:text>cm:guid</xsl:text>
- </xsl:attribute>
- <xsl:value-of select="key('target-parent',$searchPath)/*[local-name()='storeID']"/>
- </xsl:element>
- <xsl:element name="title" namespace="{namespace-uri()}">
- <xsl:value-of select="key('target-parent',$searchPath)/*[local-name()='defaultName']"/>
- </xsl:element>
- </xsl:element>
- </xsl:element>
- </xsl:template>
-
- <xsl:template match="*[local-name()='parent']" priority="2">
- <xsl:variable name="parentSearchPath"><xsl:value-of select="../*[local-name()='ancestors']/*[local-name()='ancestorInfo']/*[local-name()='searchPath']"/> </xsl:variable>
- <xsl:copy>
- <xsl:value-of select="key('target-parent',$parentSearchPath)/*[local-name()='storeID']"/>
- </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>
|