123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?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).
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- exclude-result-prefixes="xsd xsi bus nav">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <!-- global variables -->
- <xsl:variable name="xtscm" select="'http://developer.cognos.com/schemas/xts-cm/1/'"/>
- <xsl:variable name="xsd-prefix" select="'xsd'"/>
- <!-- main entry point -->
- <xsl:template match="/">
- <queryReply xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:attribute name="context">
- <xsl:value-of select="nav:searchResponse/nav:context"/>
- </xsl:attribute>
- <xsl:variable name="startingPos" select="nav:searchResponse/nav:content/@start"/>
- <xsl:variable name="hasMoreData" select="nav:searchResponse/nav:content/@more = 'true'"/>
- <xsl:for-each select="nav:searchResponse/nav:content/*">
- <xsl:call-template name="handle-first-level-children">
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="position" select="($startingPos - 1) + (position() - 1)"/>
- </xsl:call-template>
- <xsl:if test="position() = last()">
- <xsl:if test="$hasMoreData">
- <navDummyEntry namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:element name="position" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="($startingPos - 1) + (position() - 1) + 1"/>
- </xsl:element>
- </navDummyEntry>
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </queryReply>
- </xsl:template>
- <xsl:template name="handle-first-level-children">
- <xsl:param name="node"/>
- <xsl:param name="position"/>
- <xsl:if test="$node and string($node/nav:type) != ''">
- <xsl:element name="{$node/nav:type}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:apply-templates select="./*"/>
- <xsl:element name="position" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="$position"/>
- </xsl:element>
- </xsl:element>
- </xsl:if>
- </xsl:template>
- <xsl:template match="nav:internalId">
- <xsl:element name="id" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- <xsl:element name="storeID" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="nav:type">
- <xsl:element name="objectClass" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="nav:name">
- <xsl:element name="defaultName" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="nav:imgURL">
- <xsl:element name="iconURI" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="nav:fullName">
- <xsl:element name="{local-name()}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="nav:searchPath | nav:permissions">
- <xsl:element name="{local-name()}" namespace="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:value-of select="."/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="*"/>
- </xsl:stylesheet>
|