123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <?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:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:up="http://developer.cognos.com/schemas/upfront/"
- xmlns:cogx="http://developer.cognos.com/schemas/cogx/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
- <!--
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- -->
- <xsl:variable name="tab"><xsl:value-of select="concat(/root/tab, '-')"/></xsl:variable>
-
- <xsl:template match="/root">
- <xsl:choose>
- <xsl:when test="cogx:envelope">
- <xsl:apply-templates select="cogx:envelope"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="."/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="cogx:envelope">
- <xsl:choose>
- <xsl:when test="cogx:result/up:Result/up:NewsBox">
- <cm:queryResponse>
- <cm:queryReply>
- <xsl:if test="/root/nbid != ''">
- <xsl:apply-templates select="cogx:result/up:Result/up:NewsBox"/>
- </xsl:if>
- </cm:queryReply>
- <cm:queryReply>
- <xsl:apply-templates select="cogx:result/up:Result/up:NewsBox/*[starts-with(local-name(), 'NewsBox') or starts-with(local-name(), 'NewsItem')]"/>
- </cm:queryReply>
- </cm:queryResponse>
- </xsl:when>
- <xsl:when test="cogx:result/up:Result/up:System">
- <up:system>
- <xsl:apply-templates select="cogx:result/up:Result/up:System"/>
- </up:system>
- </xsl:when>
- <xsl:when test="cogx:result/up:Result/up:User">
- <up:user>
- <xsl:apply-templates select="cogx:result/up:Result/up:User"/>
- </up:user>
- </xsl:when>
- <xsl:otherwise>
- <cm:queryResponse>
- <cm:queryReply/>
- <cm:queryReply>
- <xsl:apply-templates select="cogx:result//up:Result/*[starts-with(local-name(), 'NewsBox') or starts-with(local-name(), 'NewsItem')]"/>
- </cm:queryReply>
- </cm:queryResponse>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="up:NewsBox | up:NewsBoxShortcut">
- <cm:folder>
- <cm:defaultName>
- <xsl:value-of select="up:Name"/>
- </cm:defaultName>
- <cm:defaultDescription>
- <xsl:value-of select="up:Description"/>
- </cm:defaultDescription>
- <cm:objectClass>folder</cm:objectClass>
- <cm:permissions>read traverse</cm:permissions>
- <cm:usage>folder</cm:usage>
- <cm:nbsid><xsl:value-of select="up:Id"/></cm:nbsid>
- <xsl:choose>
- <xsl:when test="local-name() = 'NewsBox'">
- <cm:nbid><xsl:value-of select="concat($tab, up:Id)"/></cm:nbid>
- </xsl:when>
- <xsl:otherwise>
- <!-- assume that newsboxshortcuts point to public newsboxes - there's no easy way to tell, and this is probably right most of the time -->
- <cm:nbid><xsl:value-of select="concat('p-', up:NewsBox/up:Id)"/></cm:nbid>
- <cm:upfShortCut>true</cm:upfShortCut>
- <!--xsl:copy-of select="up:NewsBox"/-->
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="up:FullPath"/>
- <cm:updateDate><xsl:value-of select="up:CreateDate"/></cm:updateDate>
- <cm:upfFullName><xsl:value-of select="up:FullName"/></cm:upfFullName>
- <!--xsl:copy-of select="*"/-->
- </cm:folder>
- </xsl:template>
- <xsl:template match="up:NewsItem | up:NewsItemShortcut">
- <xsl:choose>
- <xsl:when test="up:ProviderType = 'Other' or up:NewsItem/up:ProviderType = 'Other' or up:ProviderType ='Upfront' or up:NewsItem/up:ProviderType ='Upfront'">
- <cm:URL>
- <cm:defaultName>
- <xsl:value-of select="up:Name"/>
- </cm:defaultName>
- <cm:defaultDescription>
- <xsl:value-of select="up:Description"/>
- </cm:defaultDescription>
- <cm:objectClass>URL</cm:objectClass>
- <cm:permissions>read</cm:permissions>
- <xsl:choose>
- <xsl:when test="local-name() = 'NewsItem'">
- <cm:uri><xsl:value-of select="up:Action[1]/up:URL"/></cm:uri>
- <cm:icon>
- <xsl:choose>
- <xsl:when test="up:PictureURLText != ''"><xsl:value-of select="up:PictureURLText"/></xsl:when>
- <xsl:when test="up:PictureFileName != ''"><xsl:value-of select="up:PictureFileName"/></xsl:when>
- </xsl:choose>
- </cm:icon>
- <cm:updateDate><xsl:value-of select="up:UpdateDate"/></cm:updateDate>
- </xsl:when>
- <xsl:otherwise>
- <cm:uri><xsl:value-of select="up:NewsItem/up:Action[1]/up:URL"/></cm:uri>
- <cm:updateDate><xsl:value-of select="up:NewsItem/up:UpdateDate"/></cm:updateDate>
- <cm:icon>
- <xsl:choose>
- <xsl:when test="up:NewsItem/up:PictureURLText != ''"><xsl:value-of select="up:NewsItem/up:PictureURLText"/></xsl:when>
- <xsl:when test="up:NewsItem/up:PictureFileName != ''"><xsl:value-of select="up:NewsItem/up:PictureFileName"/></xsl:when>
- </xsl:choose>
- </cm:icon>
- <cm:upfShortCut>true</cm:upfShortCut>
- </xsl:otherwise>
- </xsl:choose>
- <cm:usage>object</cm:usage>
- <cm:nid><xsl:value-of select="up:Id"/></cm:nid>
- <cm:upfFullName><xsl:value-of select="up:FullName"/></cm:upfFullName>
- <!--xsl:copy-of select="*"/-->
- </cm:URL>
- </xsl:when>
- <xsl:otherwise>
- <cm:query>
- <cm:defaultName>
- <xsl:value-of select="up:Name"/>
- </cm:defaultName>
- <cm:defaultDescription>
- <xsl:value-of select="up:Description"/>
- </cm:defaultDescription>
- <cm:objectClass>query</cm:objectClass>
- <cm:permissions>read</cm:permissions>
- <xsl:choose>
- <xsl:when test="local-name() = 'NewsItem'">
- <xsl:variable name="default-action" select="up:DefaultAction"/>
- <cm:uri><xsl:value-of select="up:Action[up:Name = $default-action]/up:URL"/></cm:uri>
- <cm:updateDate><xsl:value-of select="up:UpdateDate"/></cm:updateDate>
- <cm:icon>
- <xsl:choose>
- <xsl:when test="up:PictureURLText != ''"><xsl:value-of select="up:PictureURLText"/></xsl:when>
- <xsl:when test="up:PictureFileName != ''"><xsl:value-of select="up:PictureFileName"/></xsl:when>
- </xsl:choose>
- </cm:icon>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="default-action" select="up:NewsItem/up:DefaultAction"/>
- <cm:uri><xsl:value-of select="up:NewsItem/up:Action[up:Name = $default-action]/up:URL"/></cm:uri>
- <cm:updateDate><xsl:value-of select="up:NewsItem/up:UpdateDate"/></cm:updateDate>
- <cm:icon>
- <xsl:choose>
- <xsl:when test="up:NewsItem/up:PictureURLText != ''"><xsl:value-of select="up:NewsItem/up:PictureURLText"/></xsl:when>
- <xsl:when test="up:NewsItem/up:PictureFileName != ''"><xsl:value-of select="up:NewsItem/up:PictureFileName"/></xsl:when>
- </xsl:choose>
- </cm:icon>
- <cm:upfShortCut>true</cm:upfShortCut>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="up:PrimaryNewsItemId != ''"><cm:upfCustomView>true</cm:upfCustomView></xsl:if>
- <cm:usage>object</cm:usage>
- <cm:nid><xsl:value-of select="up:Id"/></cm:nid>
- <cm:upfFullName><xsl:value-of select="up:FullName"/></cm:upfFullName>
- <cm:upfProviderType><xsl:value-of select="up:ProviderType"/></cm:upfProviderType>
- <!--xsl:copy-of select="*"/-->
- </cm:query>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="up:FullPath">
- <cm:ancestors>
- <xsl:choose>
- <xsl:when test="$tab = 'p-'">
- <cm:ancestorInfo>
- <cm:objectClass>content</cm:objectClass>
- <cm:searchPath>/content</cm:searchPath>
- <cm:title><xsl:value-of select="/root/pr"/></cm:title>
- <cm:storeID><xsl:value-of select="/root/prid"/></cm:storeID>
- </cm:ancestorInfo>
- </xsl:when>
- <xsl:otherwise>
- <cm:ancestorInfo>
- <cm:objectClass>directory</cm:objectClass>
- <cm:searchPath>/directory</cm:searchPath>
- <cm:title><xsl:value-of select="/root/pr"/></cm:title>
- <cm:storeID/>
- </cm:ancestorInfo>
- <cm:ancestorInfo>
- <cm:objectClass>folder</cm:objectClass>
- <cm:searchPath><xsl:value-of select="/root/mfpath"/></cm:searchPath>
- <cm:title><xsl:value-of select="/root/mr"/></cm:title>
- <cm:storeID><xsl:value-of select="/root/mrid"/></cm:storeID>
- </cm:ancestorInfo>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:for-each select="descendant::up:NewsBoxPath">
- <xsl:if test="($tab = 'p-' and position() > 1) or ($tab = 'm-' and position() > 3)">
- <cm:ancestorInfo>
- <cm:objectClass>folder</cm:objectClass>
- <cm:searchPath><xsl:value-of select="/root/mfpath"/></cm:searchPath>
- <cm:searchID>
- <xsl:choose>
- <xsl:when test="($tab = 'p-' and position() > 1) or position() > 3"><xsl:value-of select="concat($tab, up:Id)"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$tab"/></xsl:otherwise>
- </xsl:choose>
- </cm:searchID>
- <cm:title><xsl:value-of select="up:Name"/></cm:title>
- </cm:ancestorInfo>
- </xsl:if>
- </xsl:for-each>
- </cm:ancestors>
- </xsl:template>
- <xsl:template match="up:System">
- <BaseNewsBoxId><xsl:value-of select="up:BaseNewsBoxId"/></BaseNewsBoxId>
- </xsl:template>
-
- <xsl:template match="up:User">
- <PersonalNewsBoxID><xsl:value-of select="up:PersonalNewsBoxId"/></PersonalNewsBoxID>
- </xsl:template>
-
- <xsl:template match="text()"/>
- </xsl:stylesheet>
|