123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (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:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
- exclude-result-prefixes="xts xtsext wsrp">
- <xsl:output method="xml" omit-xml-declaration="yes" version="1.0" encoding="UTF-8" indent="no"/>
- <!--
- <xsl:variable name="page-context">
- <xsl:choose>
- <xsl:when test="/root/newPageContext/*[local-name()='pageletContext']"><xsl:value-of select="/root/newPageContext/*[local-name()='pageletContext']"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="/root/currentPageContext/*[local-name()='pageletContext']"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- -->
- <xsl:variable name="new-page-context" select="/root/newPageContext/*[local-name()='pageletContext']"/>
- <xsl:variable name="current-page-context" select="/root/currentPageContext/*[local-name()='pageletContext']"/>
- <xsl:variable name="ui-state-params" select="/root/portletState/param"/>
- <xsl:variable name="ui-session-params" select="/root/session/param"/>
- <xsl:variable name="ui-window-state" select="/root/windowState"/>
- <xsl:template match="/">
- <wsrp:markupString>
- <xsl:if test="$ui-session-params[@name='display_id'] != ''">
- <xsl:text><a href="wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=set:</xsl:text>
- <xsl:value-of select="$ui-state-params[@name = 'channel']"/>
- <xsl:text>&wsrp-windowState=</xsl:text>
- <xsl:value-of select="$ui-window-state"/>
- <xsl:text>&wsrp-navigationalState=&display_id=/wsrp_rewrite"></xsl:text><xts:string id="IDS_NAV_VEW_BACK_TO_DEFAULT"/><xsl:text></a><br></xsl:text>
- </xsl:if>
- <xsl:call-template name="rewrite">
- <xsl:with-param name="string" select="/root/*[local-name()='getPageletResponse']/*[local-name()='pageletMarkup']/*[local-name()='markupString']"/>
- </xsl:call-template>
- <xsl:value-of select="/root/preview-markup"/>
- </wsrp:markupString>
- <wsrp:requiresUrlRewriting>true</wsrp:requiresUrlRewriting>
- </xsl:template>
- <xsl:variable name="STARTMARKER" select="'wsrp_rewrite?'"/>
- <xsl:variable name="ENDMARKER" select="'/wsrp_rewrite'"/>
- <xsl:template name="rewrite">
- <xsl:param name="string" select="."/>
- <xsl:variable name="before" select="substring-before($string, $STARTMARKER)"/>
- <xsl:choose>
- <xsl:when test="$before = ''">
- <xsl:value-of select="$string"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable name="content" select="substring-after(substring-before($string, $ENDMARKER), $STARTMARKER)"/>
- <xsl:choose>
- <xsl:when test="contains($content, 'wsrp-urlType=resource')">
- <xsl:value-of select="concat($before, $STARTMARKER, $content, $ENDMARKER)"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- package everything in the new navigational state -->
- <xsl:variable name="new-navigational-state">
- <!-- pagelet id -->
- <xsl:text><param name="pagelet-id"></xsl:text>
- <xsl:value-of select="/root/pageletId"/>
- <xsl:text></param></xsl:text>
-
- <!-- original url params -->
- <xsl:text><param name="pagelet-params"></xsl:text>
- <xsl:value-of select="xtsext:xmlencode($content)"/>
- <xsl:text></param></xsl:text>
-
- <!-- pagelet state path-->
- <xsl:text><param name="pageletStatePath"></xsl:text>
- <xsl:choose>
- <xsl:when test="$new-page-context"><xsl:value-of select="$new-page-context/*[local-name()='path']"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$current-page-context/*[local-name()='path']"/></xsl:otherwise>
- </xsl:choose>
- <xsl:text></param></xsl:text>
-
- <!-- pagelet state -->
- <xsl:text><param name="pageletState"></xsl:text>
- <xsl:choose>
- <xsl:when test="$new-page-context"><xsl:value-of select="$new-page-context/*[local-name()='state']"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$current-page-context/*[local-name()='state']"/></xsl:otherwise>
- </xsl:choose>
- <xsl:text></param></xsl:text>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="contains($content,'wsrp-urlType=render')">
- <xsl:value-of select="concat($before, $STARTMARKER, 'wsrp-urlType=render&wsrp-requiresUrlRewriting=true&wsrp-navigationalState=', xtsext:urlencode(xtsext:validator('prepare','new-navigational-state',xtsext:base64encode($new-navigational-state, true()))), $ENDMARKER)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($before, $STARTMARKER, 'wsrp-urlType=blockingAction&wsrp-interactionState=merge&wsrp-requiresUrlRewriting=true&wsrp-navigationalState=', xtsext:urlencode(xtsext:validator('prepare','new-navigational-state',xtsext:base64encode($new-navigational-state, true()))), $ENDMARKER)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:call-template name="rewrite">
- <xsl:with-param name="string" select="substring-after($string, $ENDMARKER)"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|