1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2010, 2011
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- This transform generates a list of package and folder entries based on a list of search path
- and a list of cm query response
- It goes to the actual list of searchPath and checks if a corresponding entry exists, if not an element is
- created with an "unavailable name"
- The list of entries is sorted by the default name. The expected input is the following:
- <packageAndFolderContent>
- <content>
- <type of object>
- <property></property>
- ...
- </type of object>
- <content>
- <contentLocale>used for sorting</contentLocale>
- </packageAndFolderContent>
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:template match="/packageAndFolderContent">
- <xsl:element name="content" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:variable name="unsortedContent">
- <xsl:for-each select="searchPathList/searchPath">
- <xsl:variable name="currentSearchPath" select="string(.)"/>
- <xsl:variable name="cmEntry" select="/packageAndFolderContent/cm:queryResponse/cm:queryReply/*[string(cm:searchPath)=$currentSearchPath]"/>
- <xsl:choose>
- <xsl:when test="$cmEntry">
- <xsl:copy-of select="$cmEntry"/>
- </xsl:when>
- <xsl:otherwise>
- <cm:folder>
- <cm:searchPath><xsl:value-of select="."/></cm:searchPath>
- <cm:defaultName><xts:string id="IDS_CONTENT_TASK_UNAVAILABLE_CONTENT"/></cm:defaultName>
- </cm:folder>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:for-each select="$unsortedContent/*">
- <xsl:sort lang="{/packageAndFolderContent/contentLocale}" select="cm:defaultName" order="ascending"/>
- <xsl:copy-of select="."/>
- </xsl:for-each>
- </xsl:element>
- </xsl:template>
- </xsl:stylesheet>
|