12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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() = 'package' or local-name() = 'folder' or local-name() = 'content']" use="*[local-name()='searchPath']"/>
- <xsl:template match="/root" priority="1">
- <xsl:apply-templates select="*"/>
- </xsl:template>
-
- <xsl:template match="*[local-name()='queryReply']" priority="1">
- </xsl:template>
- <xsl:template match="*[local-name()='packageDeploymentInfo']" priority="2">
- <xsl:copy>
- <xsl:copy-of select="*[local-name()='targetName']"/>
- <xsl:copy-of select="*[local-name()='archiveSearchPath']"/>
- <xsl:copy-of select="*[local-name()='storeID']"/>
- <xsl:copy-of select="*[local-name()='targetLocation']"/>
-
- <xsl:variable name="storeID" select="*[local-name()='archiveSearchPath']"/>
- <!-- following 2 variables used to convert a storeID to the format storeID('XXXXXXXXX') -->
- <xsl:variable name="storeIDPrefix"><xsl:text>storeID('</xsl:text></xsl:variable>
- <xsl:variable name="storeIDSuffix"><xsl:text>')</xsl:text></xsl:variable>
-
- <!-- get the searchPath from the storeID-searchPath map generated in a previous block -->
- <xsl:variable name="searchPathValue" select="/root/*[local-name() = 'storeIDMap']/*[local-name() = 'queryResponse']/*[local-name() = 'queryReply']/*[(local-name() = 'package' or local-name() = 'folder')][concat($storeIDPrefix,*[local-name()='storeID'],$storeIDSuffix)=$storeID]/*[local-name()='searchPath']"/>
- <xsl:element name="enabled" namespace="{namespace-uri()}">
- <xsl:copy-of select="*[local-name()='enabled']"/>
- </xsl:element>
- <xsl:element name="ancestors" namespace="{namespace-uri()}">
- <xsl:copy-of select="*[local-name()='ancestorInfo']"/>
- </xsl:element>
- <xsl:element name="sourceName" namespace="{namespace-uri()}">
- <xsl:copy-of select="key('target-parent',$searchPathValue)/*[local-name()='name']/*[local-name()='multilingualToken']"/>
- </xsl:element>
- <xsl:element name="ancestorsSource" namespace="{namespace-uri()}">
- <xsl:element name="ancestorInfo" namespace="{namespace-uri()}">
- <xsl:copy-of select="key('target-parent',$searchPathValue)/*[local-name()='ancestors']/*[local-name()='ancestorInfo']/*[local-name()='title']"/>
- <xsl:copy-of select="key('target-parent',$searchPathValue)/*[local-name()='ancestors']/*[local-name()='ancestorInfo']/*[local-name()='searchPath']"/>
- <xsl:copy-of select="key('target-parent',$searchPathValue)/*[local-name()='ancestors']/*[local-name()='ancestorInfo']/*[local-name()='storeID']"/>
- </xsl:element>
- </xsl:element>
- <xsl:copy-of select="key('target-parent',$searchPathValue)/*[local-name()='defaultName']"/>
- <xsl:copy-of select="key('target-parent',$searchPathValue)/*[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>
|