123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955 |
- <?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).
- -->
- <!-- $Header: //cpscrn/main/templates/cps4/producer/logicsheets/cps-portlet.xslt#1 $ -->
- <!-- $DateTime: 2008/10/22 11:12:04 $ -->
- <!-- $Change: 25109 $ -->
- <!-- NOTE: nodelist requirements for this logicsheet: envelope,session,system,configProps -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:out="dummy-uri"
- xmlns:java="java:com.cognos.portal.utils.CCLLocaleUtils"
- xmlns:bidi="java:com.cognos.portal.utils.BidiUtils"
- xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:crn="http://developer.cognos.com/schemas/crconfig/1/"
- xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/"
- xmlns:portlet="http://developer.cognos.com/schemas/cps/logic/portlet/1/"
- xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:template match="xsl:stylesheet" priority="1">
- <xsl:copy>
- <xsl:apply-templates select="@*"/>
- <out:variable name="portlet-op" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
- <out:variable name="portlet-op-name" select="local-name( $portlet-op )"/>
- <out:variable name="portlet-markups" select="$portlet-op/wsrp:markupParams"/>
- <out:variable name="portlet-session-params" select="/root/session/param"/>
- <out:variable name="portlet-state-params" select="$portlet-op/wsrp:portletContext/wsrp:portletState/param"/>
- <out:variable name="portlet-registration-params" select="$portlet-op/wsrp:registrationContext/wsrp:registrationState/param"/>
- <out:variable name="portlet-navigational-params" select="$portlet-markups/wsrp:navigationalState/param"/>
- <out:variable name="portlet-interaction-params" select="$portlet-op/wsrp:interactionParams"/>
- <out:variable name="portlet-form-params" select="$portlet-op/wsrp:interactionParams/wsrp:formParameters"/>
- <out:variable name="portlet-configuration" select="/root/configProps/param[@name='cps']/property"/>
- <out:variable name="portlet-system-params" select="/root/system/param"/>
- <out:variable name="portlet-mode" select="$portlet-markups/wsrp:mode"/>
- <out:variable name="portlet-window-state" select="$portlet-markups/wsrp:windowState"/>
- <out:variable name="portlet-product-locale" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/bus:userPreferenceVars/item[name='productLocale']/value"/>
- <out:variable name="portlet-content-locale" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/bus:userPreferenceVars/item[name='contentLocale']/value"/>
- <out:variable name="portlet-is-ui-rtl" select="bidi:isRTLLocale(string($portlet-product-locale))"/>
- <out:variable name="portlet-user-preferences" select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/bus:userPreferenceVars"/>
- <out:variable name="portlet-isBidiEnabled">
- <out:choose>
- <out:when test="$portlet-user-preferences/item[name='http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#biDirectionalFeaturesEnabled']/value != ''">
- <out:value-of select="$portlet-user-preferences/item[name='http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#biDirectionalFeaturesEnabled']/value = 'true'"/>
- </out:when>
- <out:otherwise>false()</out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="portlet-baseTextDirection">
- <out:variable name="ns_name">
- <out:value-of select="$portlet-user-preferences/item[name='http://developer.cognos.com/ceba/constants/biDirectionalOptionEnum#baseTextDirection']/value"/>
- </out:variable>
- <out:choose>
- <out:when test="$ns_name != ''">
- <out:value-of select="translate(substring-after($ns_name,'#'),'LTRA','ltra')"/>
- </out:when>
- <out:otherwise>auto</out:otherwise>
- </out:choose>
- </out:variable>
- <out:variable name="portlet-is-cognos-connection" select="$portlet-markups/wsrp:extensions/cps:portalContext/cps:portalAgent = 'cognos'"/>
- <out:variable name="portlet-is-myportal" select="$portlet-markups/wsrp:extensions/cps:portalContext/cps:portalAgent = 'cognosFragmentServer'"/>
- <xsl:apply-templates select="*|text()|processing-instruction()"/>
- <xsl:apply-templates select="//portlet:content" mode="gen-code"/>
- <out:template name="portlet-get-property">
- <out:param name="property-name"/>
- <out:param name="property-exclude-form-input" select="'true'"/>
- <out:param name="property-exclude-nav-state" select="'false'"/>
- <out:param name="property-exclude-session-state" select="'false'"/>
- <out:param name="property-default" select="''"/>
- <out:choose>
- <!-- level 1: form params (when performBlockingInteraction) -->
- <out:when test="not($property-exclude-form-input = 'true') and ($portlet-form-params[@name = string( $property-name )])">
- <out:value-of select="$portlet-form-params[@name = string( $property-name )]/wsrp:value"/>
- </out:when>
- <!-- level 2: navigational params -->
- <out:when test="not($property-exclude-nav-state = 'true') and ($portlet-navigational-params[@name = string( $property-name )])">
- <out:value-of select="$portlet-navigational-params[@name = string( $property-name )]"/>
- </out:when>
- <!-- level 3: session states -->
- <out:when test="not($property-exclude-session-state = 'true') and ($portlet-session-params[@name = string( $property-name )] != '')">
- <out:value-of select="$portlet-session-params[@name = string( $property-name )]"/>
- </out:when>
- <!-- level 4: portlet states -->
- <out:when test="$portlet-state-params[@name = string( $property-name )]">
- <out:value-of select="$portlet-state-params[@name = string( $property-name )]"/>
- </out:when>
- <!-- level 5: registration params -->
- <out:when test="$portlet-registration-params[@name = string( $property-name )] != ''">
- <out:value-of select="$portlet-registration-params[@name = string( $property-name )]"/>
- </out:when>
- <!-- level 6: configuration API (either property[@name] or property['CPS']/parameter[@name]) -->
- <out:when test="$portlet-configuration[@name = string( $property-name )] != ''">
- <out:value-of select="$portlet-configuration[@name = string( $property-name )]"/>
- </out:when>
- <out:when test="$portlet-configuration[@name = 'CPS']/crn:value/crn:parameter[@name = string( $property-name )]/crn:value != ''">
- <out:value-of select="$portlet-configuration[@name = 'CPS']/crn:value/crn:parameter[@name = string( $property-name )]/crn:value"/>
- </out:when>
- <!-- level 7: system params -->
- <out:when test="$portlet-system-params[@name = string( $property-name )] != ''">
- <out:value-of select="$portlet-system-params[@name = string( $property-name )]"/>
- </out:when>
- <!-- level 8: default in the code -->
- <out:otherwise>
- <out:value-of select="$property-default"/>
- </out:otherwise>
- </out:choose>
- </out:template>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="portlet:passport" priority="1">
- <out:variable name="passport">
- <out:choose>
- <!-- pull the passport out of the bus header -->
- <out:when test="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']">
- <out:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
- </out:when>
- <!-- For those blocks that specify node list and execlude <credential> node -->
- <out:when test="/root/header/*[local-name() = 'biBusHeader']/*[local-name()= 'CAM']/CAMPassport/id">
- <out:value-of select="/root/header/*[local-name() = 'biBusHeader']/*[local-name()= 'CAM']/CAMPassport/id"/>
- </out:when>
- <!-- For those super rare cases where both <credential> and <header> elements are not available - or - the passport is being cleared -->
- <out:otherwise>
- <out:variable name="CAMPassportCookie">
- <out:choose>
- <out:when test="/root/setCookies/cookie[@name='cam_passport' and string(@maxAge) != '-1']">
- <out:value-of select="string(/root/setCookies/cookie[@name='cam_passport'])"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="string(/root/cookies/cookie[@name='cam_passport'])"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- <out:value-of select="xtsext:camcookie_action('getPassportID', $CAMPassportCookie)"/>
- </out:otherwise>
- </out:choose>
- </out:variable>
- </xsl:template>
- <xsl:template match="portlet:property" priority="1">
- <xsl:choose>
- <xsl:when test="@name">
- <out:variable name="{ @name }">
- <out:call-template name="portlet-get-property">
- <out:with-param name="property-name">
- <xsl:choose>
- <xsl:when test="@select">
- <out:value-of select="{ @select }"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:apply-templates/>
- </xsl:otherwise>
- </xsl:choose>
- </out:with-param>
- <xsl:if test="@default">
- <out:with-param name="property-default">
- <out:value-of select="{ @default }"/>
- </out:with-param>
- </xsl:if>
- <xsl:if test="@exclude-form-input">
- <out:with-param name="property-exclude-form-input">
- <out:value-of select="{ @exclude-form-input }"/>
- </out:with-param>
- </xsl:if>
- <xsl:if test="@exclude-nav-state">
- <out:with-param name="property-exclude-nav-state">
- <out:value-of select="{ @exclude-nav-state }"/>
- </out:with-param>
- </xsl:if>
- <xsl:if test="@exclude-session-state">
- <out:with-param name="property-exclude-session-state">
- <out:value-of select="{ @exclude-session-state }"/>
- </out:with-param>
- </xsl:if>
- </out:call-template>
- </out:variable>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0001</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: name (xsd:string)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:portlet" priority="1">
- <xsl:choose>
- <xsl:when test="@handle">
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0002</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: handle (xsd:string)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="portlet:soap-fault" priority="1">
-
- <xsl:choose>
- <xsl:when test="not(ancestor::portlet:soap-response)">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0022</xsl:with-param>
- <xsl:with-param name="errmsg">Missing ancestor tag: soap-response</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="not(@select)">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0023</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: select</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <SOAP-ENV:Fault>
- <out:variable name="error" select="{@select}"/>
- <out:choose>
- <out:when test="$error/@type = 'invalidCookie'">
- <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" wsrp:dummy="">wsrp:InvalidCookie</faultcode>
- <faultstring><out:value-of select="$error/message"/></faultstring>
- <detail>
- <wsrp:InvalidCookie xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" />
- </detail>
- </out:when>
- <out:otherwise>
- <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types">wsrp:OperationFailed</faultcode>
- <faultstring>Normal execution of the operation failed.</faultstring>
- <detail>
- <wsrp:OperationFailed xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"/>
- <out:copy-of select="$error"/>
- </detail>
- </out:otherwise>
- </out:choose>
- </SOAP-ENV:Fault>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="portlet:soap-response" priority="1">
- <xts:sequence>
- <xts:append select="/root/output">
- <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml; charset=utf-8</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <out:copy-of select="/root/envelope/SOAP-ENV:Envelope/SOAP-ENV:Header"/>
- <SOAP-ENV:Body>
- <xsl:apply-templates/>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xos:entityBody>
- </xos:part>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- <xsl:template match="portlet:response" priority="1">
- <out:element name="wsrp:{'{ '}$portlet-op-name{' }'}Response" namespace="urn:oasis:names:tc:wsrp:v1:types">
- <xsl:apply-templates/>
- </out:element>
- </xsl:template>
- <xsl:template match="portlet:redirectURL" priority="1">
- <xsl:choose>
- <xsl:when test="child::node()">
- <wsrp:redirectURL>
- <xsl:apply-templates/>
- </wsrp:redirectURL>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0003</xsl:with-param>
- <xsl:with-param name="errmsg">Empty tag is not allowed here '<xsl:value-of select="name(.)"/>'</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:content" priority="1">
- <out:choose>
- <out:when test="$portlet-op-name = 'performBlockingInteraction'">
- <wsrp:updateResponse>
- <out:call-template name="{ generate-id() }"/>
- </wsrp:updateResponse>
- </out:when>
- <out:otherwise>
- <out:call-template name="{ generate-id() }"/>
- </out:otherwise>
- </out:choose>
- </xsl:template>
- <xsl:template match="portlet:content" mode="gen-code" priority="1">
- <out:template name="{ generate-id() }">
- <xsl:apply-templates/>
- </out:template>
- </xsl:template>
- <xsl:template match="portlet:session-context" priority="1">
- <wsrp:sessionContext>
- <xsl:choose>
- <xsl:when test="@sessionID">
- <wsrp:sessionID>
- <out:value-of select="{ @sessionID }"/>
- </wsrp:sessionID>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0004</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: sessionID (xsd:string)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="@expires">
- <wsrp:expires>
- <out:value-of select="{ @expires }"/>
- </wsrp:expires>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0005</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: expires (xsd:boolean)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates/>
- </wsrp:sessionContext>
- </xsl:template>
- <xsl:template match="portlet:portlet-context" priority="1">
- <out:if test="$portlet-op-name = 'performBlockingInteraction'">
- <wsrp:portletContext>
- <wsrp:portletHandle>
- <out:value-of select="$portlet-op/wsrp:portletContext/wsrp:portletHandle"/>
- <out:if test="not( contains( $portlet-op/wsrp:portletContext/wsrp:portletHandle, ':' ) )">
- <out:value-of select="concat(':', xtsext:generateGUID())"/>
- </out:if>
- </wsrp:portletHandle>
- <wsrp:portletState>
- <xsl:choose>
- <xsl:when test="@portletState">
- <out:value-of select="xtsext:base64encode(string({ @portletState }), true())"/>
- </xsl:when>
- <xsl:otherwise>
- <out:variable name="portlet-state">
- <xsl:apply-templates/>
- </out:variable>
- <out:value-of select="xtsext:base64encode(string($portlet-state), true())"/>
- </xsl:otherwise>
- </xsl:choose>
- </wsrp:portletState>
- </wsrp:portletContext>
- </out:if>
- </xsl:template>
- <xsl:template match="portlet:markup-context" priority="1">
- <wsrp:markupContext>
- <wsrp:useCachedMarkup>
- <xsl:choose>
- <xsl:when test="@useCachedMarkup">
- <out:value-of select="{ @useCachedMarkup }"/>
- </xsl:when>
- <xsl:otherwise>false</xsl:otherwise>
- </xsl:choose>
- </wsrp:useCachedMarkup>
- <wsrp:mimeType>
- <xsl:choose>
- <xsl:when test="@mimeType">
- <out:value-of select="{ @mimeType }"/>
- </xsl:when>
- <xsl:otherwise>text/html</xsl:otherwise>
- </xsl:choose>
- </wsrp:mimeType>
- <xsl:apply-templates/>
- <xsl:if test="@preferredTitle">
- <wsrp:preferredTitle>
- <out:value-of select="{ @preferredTitle }"/>
- </wsrp:preferredTitle>
- </xsl:if>
- </wsrp:markupContext>
- </xsl:template>
- <xsl:template match="portlet:navigational-state" priority="1">
- <out:if test="$portlet-op-name = 'performBlockingInteraction'">
- <wsrp:navigationalState>
- <out:variable name="portlet-markup">
- <xsl:if test="@select">
- <out:for-each select="{ @select }">
- <out:value-of select="concat('<param name="', @name, '">', xtsext:xmlencode(.), '</param>')"/>
- </out:for-each>
- </xsl:if>
- <xsl:apply-templates/>
- </out:variable>
- <out:value-of select="xtsext:validator('prepare','portlet-markup',xtsext:base64encode($portlet-markup, true()))"/>
- </wsrp:navigationalState>
- </out:if>
- </xsl:template>
-
- <xsl:template match="portlet:param" priority="1">
- <out:variable name="portlet-{generate-id()}value">
- <xsl:apply-templates/>
- </out:variable>
- <out:value-of select="concat('<param name="', { @name }, '">', xtsext:xmlencode($portlet-{generate-id()}value), '</param>')"/>
- </xsl:template>
- <xsl:template match="portlet:markup-string" priority="1">
- <wsrp:markupString>
- <xsl:if test="child::node()">
- <xts:transform name="XMLEncode" option="content">
- <xsl:apply-templates/>
- </xts:transform>
- </xsl:if>
- </wsrp:markupString>
- <wsrp:locale>
- <xsl:choose>
- <xsl:when test="ancestor::portlet:markup-context/@locale">
- <out:value-of select="{ ancestor::portlet:markup-context/@locale }"/>
- </xsl:when>
- <xsl:otherwise>en</xsl:otherwise>
- </xsl:choose>
- </wsrp:locale>
- <xsl:if test="ancestor::portlet:markup-context/@requiresUrlRewriting">
- <wsrp:requiresUrlRewriting>
- <out:value-of select="{ ancestor::portlet:markup-context/@requiresUrlRewriting }"/>
- </wsrp:requiresUrlRewriting>
- </xsl:if>
- </xsl:template>
- <xsl:template match="portlet:markup-transform" priority="1">
-
- <wsrp:markupString>
- <xts:transform name="XMLEncode" option="content">
-
-
- <out:if test="$portlet-registration-params[@name = 'consumerAgent'] = 'liferay'">
- <out:text disable-output-escaping="yes"><div style='overflow:auto'></out:text>
- </out:if>
-
-
- <xsl:choose>
- <xsl:when test="@name = 'XML'">
- <xts:transform name="XML" cache="false">
- <xts:param name="systemId">no-cache-id</xts:param>
- <xts:param name="messageBaseLocale">
- <out:value-of select="$portlet-product-locale"/>
- </xts:param>
- <xsl:apply-templates/>
- </xts:transform>
- </xsl:when>
- <xsl:when test="@name = 'XSLT'">
- <xsl:choose>
- <xsl:when test="@src">
- <xts:transform name="XSLT" src="{'{'}{ @src }{'}'}">
- <xts:param name="messageBaseLocale">
- <out:value-of select="$portlet-product-locale"/>
- </xts:param>
- <xsl:apply-templates/>
- </xts:transform>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0010</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute name: src (xsd:string)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0011</xsl:with-param>
- <xsl:with-param name="errmsg">Unsupported transformation name: '<xsl:value-of select="@name"/>'</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
-
-
- <out:if test="$portlet-registration-params[@name = 'consumerAgent'] = 'liferay'">
- <out:text disable-output-escaping="yes"></div></out:text>
- </out:if>
-
-
- </xts:transform>
- </wsrp:markupString>
- <wsrp:locale>
- <xsl:choose>
- <xsl:when test="ancestor::portlet:markup-context/@locale">
- <out:value-of select="{ ancestor::portlet:markup-context/@locale }"/>
- </xsl:when>
- <xsl:otherwise>en</xsl:otherwise>
- </xsl:choose>
- </wsrp:locale>
- <xsl:if test="ancestor::portlet:markup-context/@requiresUrlRewriting">
- <wsrp:requiresUrlRewriting>
- <out:value-of select="{ ancestor::portlet:markup-context/@requiresUrlRewriting }"/>
- </wsrp:requiresUrlRewriting>
- </xsl:if>
- </xsl:template>
- <xsl:template match="portlet:markup-preview" priority="1">
- <xsl:choose>
- <xsl:when test="not(ancestor::portlet:portlet[1]/@handle)">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0025</xsl:with-param>
- <xsl:with-param name="errmsg">Missing ancestor tag: portlet with handle attribute</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xts:transform processor="XSLT" src="/cps4/producer/wsrp-impl/transforms/preview-help.xslt">
- <xts:param name="messageBaseLocale">
- <out:value-of select="$portlet-product-locale"/>
- </xts:param>
- <xts:param name="logicsheet">/cps4/producer/logicsheets/cps-ui.xslt</xts:param>
- <xts:param name="messageBase">/cps4/producer/messages/cpsproducermsgs.xml</xts:param>
- <xts:param name="systemId">/cps4/producer/wsrp-impl/transforms/preview-help.xslt</xts:param>
- <root>
- <xts:queryNode select="/root/envelope | /root/system | /root/configProps | /root/interfaces"/>
- <portlet id="{ ancestor::portlet:portlet[1]/@handle }"/>
- </root>
- </xts:transform>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:markup-help" priority="1">
- <xsl:choose>
- <xsl:when test="not(ancestor::portlet:portlet[1]/@handle)">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0020</xsl:with-param>
- <xsl:with-param name="errmsg">Missing ancestor tag: portlet with handle attribute</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <wsrp:markupString>
- <xts:transform name="XMLEncode" option="content">
- <xts:transform name="XSLT" src="/cps4/producer/wsrp-impl/transforms/display-help.xslt">
- <xts:param name="messageBaseLocale">
- <out:value-of select="$portlet-product-locale"/>
- </xts:param>
- <xts:param name="logicsheet">/cps4/producer/logicsheets/cps-ui.xslt</xts:param>
- <xts:param name="logicsheet">/cps4/producer/logicsheets/cps-formlogic.xslt</xts:param>
- <root>
- <xts:queryNode select="/root/envelope | /root/system | /root/configProps | /root/interfaces | /root/cookies"/>
- <xsl:apply-templates/>
- <portlet id="{ ancestor::portlet:portlet[1]/@handle }"/>
- </root>
- </xts:transform>
- </xts:transform>
- </wsrp:markupString>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:logicsheet | portlet:messageBase" priority="1">
- <xsl:choose>
- <xsl:when test="ancestor::portlet:markup-transform">
- <xts:param name="{ local-name(.) }"><xsl:apply-templates/></xts:param>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0015</xsl:with-param>
- <xsl:with-param name="errmsg">'<xsl:value-of select="name()"/>' tag misplaced ('markup-transform' ancestor tag not found)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:source" priority="1">
- <xsl:choose>
- <xsl:when test="not(ancestor::portlet:markup-transform)">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0012</xsl:with-param>
- <xsl:with-param name="errmsg">Missing ancestor tag: markup-transform</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="not(ancestor::portlet:portlet[1]/@handle)">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0014</xsl:with-param>
- <xsl:with-param name="errmsg">Missing ancestor tag: portlet with handle attribute</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="ancestor::portlet:markup-transform/@name = 'XML'">
- <xts:param name="src">
- <xsl:apply-templates/>
- </xts:param>
- </xsl:when>
- <xsl:otherwise>
- <root>
- <xts:queryNode select="/root/envelope | /root/system | /root/configProps | /root/interfaces | /root/cookies | /root/session"/>
- <xsl:apply-templates/>
- <out:variable name="consumer" select="$portlet-registration-params[@name = 'consumerAgent']"/>
- <out:variable name="is-plumtree" select="$consumer = 'plumtree'"/>
- <portlet id="{ ancestor::portlet:portlet[1]/@handle }">
- <consumer id="{ '{' }$consumer{ '}' }">
- <layout>
- <path>
- <start/>
- <separator>
- <out:choose>
- <out:when test="$is-plumtree"> : </out:when>
- <out:otherwise>
- <out:choose>
- <out:when test="$portlet-is-ui-rtl">‏ < </out:when>
- <out:otherwise>‎ > </out:otherwise>
- </out:choose>
- </out:otherwise>
- </out:choose>
- </separator>
- <end/>
- </path>
- <out:variable name="location">
- <out:choose>
- <out:when test="$is-plumtree">top-right</out:when>
- <out:otherwise>bottom-left</out:otherwise>
- </out:choose>
- </out:variable>
- <buttons location="{'{'}$location{'}'}"/>
- <backWhenMaximized>
- <out:value-of select="$is-plumtree"/>
- </backWhenMaximized>
- <linkSeparator> | </linkSeparator>
- </layout>
- <supportTitle>
- <out:value-of select="not($consumer='plumtree' or $consumer='sap' or $consumer='websphere')"/>
- </supportTitle>
- </consumer>
- </portlet>
- </root>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:if-mode" priority="1">
- <xsl:choose>
- <xsl:when test="@name">
- <out:if test="contains('|{ @name }|', concat(concat('|', string($portlet-mode)), '|'))">
- <xsl:apply-templates/>
- </out:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0006</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: name (xsd:string)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:if-window-state" priority="1">
- <xsl:choose>
- <xsl:when test="@name">
- <out:if test="contains('|{ @name }|', concat(concat('|', string($portlet-window-state)), '|'))">
- <xsl:apply-templates/>
- </out:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0007</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: name (xsd:string)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:cache-control" priority="1">
- <wsrp:cacheControl>
- <wsrp:expires>
- <xsl:choose>
- <xsl:when test="@expires">
- <out:value-of select="{ @expires }"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0008</xsl:with-param>
- <xsl:with-param name="errmsg">Missing mandatory attribute: expires (xsd:int)</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </wsrp:expires>
- <wsrp:userScope>
- <xsl:choose>
- <xsl:when test="@userScope">
- <out:value-of select="{ @userScope }"/>
- </xsl:when>
- <xsl:otherwise>wsrp:perUser</xsl:otherwise>
- </xsl:choose>
- </wsrp:userScope>
- <xsl:if test="@validateTag">
- <out:if test="string({ @validateTag }) != ''">
- <wsrp:validateTag>
- <out:value-of select="{ @validateTag }"/>
- </wsrp:validateTag>
- </out:if>
- </xsl:if>
- <xsl:apply-templates/>
- </wsrp:cacheControl>
- </xsl:template>
- <xsl:template match="portlet:preferred-title" priority="1">
- <xsl:choose>
- <xsl:when test="child::node()">
- <wsrp:preferredTitle>
- <xsl:apply-templates/>
- </wsrp:preferredTitle>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0009</xsl:with-param>
- <xsl:with-param name="errmsg">Empty tag is not allowed here '<xsl:value-of select="name(.)"/>'</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:preferred-title-localized-value" priority="1">
- <xsl:call-template name="portlet-select-preferred-title">
- <xsl:with-param name="select" select="@select"/>
- </xsl:call-template>
- </xsl:template>
- <xsl:template match="portlet:preferred-title-localized" priority="1">
- <xsl:choose>
- <xsl:when test="@select">
- <out:if test="{ @select }">
- <wsrp:preferredTitle>
- <xsl:call-template name="portlet-select-preferred-title">
- <xsl:with-param name="select" select="@select"/>
- </xsl:call-template>
- </wsrp:preferredTitle>
- </out:if>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0021</xsl:with-param>
- <xsl:with-param name="errmsg">Missing 'select' attribute here '<xsl:value-of select="name(.)"/>'</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:title-locale" priority="1">
- <titleLocale>
- <xsl:choose>
- <xsl:when test="@selectState1">
- <out:choose>
- <out:when test="{ @selectState1 }">
- <xsl:call-template name="portlet-select-title-locale">
- <xsl:with-param name="select" select="@selectState1"/>
- </xsl:call-template>
- </out:when>
- <xsl:if test="@selectState2">
- <out:when test="{ @selectState2 }">
- <xsl:call-template name="portlet-select-title-locale">
- <xsl:with-param name="select" select="@selectState2"/>
- </xsl:call-template>
- </out:when>
- </xsl:if>
- <out:otherwise>
- <out:value-of select="$portlet-content-locale"/>
- </out:otherwise>
- </out:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0024</xsl:with-param>
- <xsl:with-param name="errmsg">Missing 'selectState1' attribute here '<xsl:value-of select="name(.)"/>'</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </titleLocale>
- </xsl:template>
-
- <xsl:template name="portlet-select-title-locale">
- <xsl:param name="select"/>
- <out:variable name="currentLocales">
- <out:for-each select="{ $select }">
- <out:value-of select="substring-after( @name, 'title_' )"/>
- <out:if test="not(position() = last())">,</out:if>
- </out:for-each>
- </out:variable>
- <out:value-of select="java:getBestFitLocale(string($portlet-content-locale),string($currentLocales))"/>
- </xsl:template>
-
- <xsl:template name="portlet-select-preferred-title">
- <xsl:param name="select"/>
- <out:variable name="preferred-title-locale">
- <xsl:call-template name="portlet-select-title-locale">
- <xsl:with-param name="select" select="$select"/>
- </xsl:call-template>
- </out:variable>
- <out:for-each select="{ $select }">
- <out:if test="substring-after( @name, 'title_' ) = $preferred-title-locale">
- <out:value-of select="string(.)"/>
- </out:if>
- </out:for-each>
- </xsl:template>
- <xsl:template match="portlet:get-version" priority="1">
- <consumer>
- <out:copy-of select="$portlet-markups/wsrp:extensions/versions"/>
- </consumer>
- <producer>
- <xts:function name="getVersion">
- <xts:param name="packages">com.cognos.cps,com.cognos.xts,java.lang,javax.servlet,javax.xml.parsers,javax.xml.transform,jd.xml.xslt,org.dom4j,org.xml.sax</xts:param>
- </xts:function>
- </producer>
- </xsl:template>
- <xsl:template match="portlet:session-read" priority="1">
- <xsl:choose>
- <xsl:when test="@channel">
- <xts:transform name="XSLT" src="/cps4/producer/wsrp-impl/transforms/session-read.xslt">
- <sessiondata>
- <out:variable name="portlet-name-prefix" select="concat( $portlet-op/wsrp:registrationContext/wsrp:registrationHandle, ':', { @channel }, '#' )"/>
- <xsl:apply-templates/>
- </sessiondata>
- </xts:transform>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0018</xsl:with-param>
- <xsl:with-param name="errmsg">Missing 'channel' attribute</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:session-data" priority="1">
- <xsl:choose>
- <xsl:when test="@name != ''">
- <xsl:choose>
- <xsl:when test="ancestor::portlet:session-read">
- <item>
- <out:variable name="name">
- <out:value-of select="$portlet-name-prefix"/><out:value-of select="{@name}"/>
- </out:variable>
- <defaultName>
- <out:value-of select="$name"/>
- </defaultName>
- <state>
- <xts:transform name="XMLEncode">
- <xts:function name="TDSRequest">
- <xts:param name="action">get</xts:param>
- <xts:param name="session-id"><out:value-of select="$passport"/></xts:param>
- <xts:param name="map-id"><xsl:value-of select="'portlets'"/></xts:param>
- <xts:param name="name"><out:value-of select="$name"/></xts:param>
- </xts:function>
- </xts:transform>
- </state>
- </item>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0017</xsl:with-param>
- <xsl:with-param name="errmsg">Tag misplaced. Expecting an ancestor 'session-read'</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0016</xsl:with-param>
- <xsl:with-param name="errmsg">Missing 'name' attribute</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="portlet:extensions" priority="1">
- <wsrp:extensions>
- <xsl:choose>
- <xsl:when test="count(*) = 1">
- <xsl:apply-templates/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0013</xsl:with-param>
- <xsl:with-param name="errmsg">Only one single element is allowed in extensions tag</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </wsrp:extensions>
- </xsl:template>
- <xsl:template match="portlet:*" priority="0">
- <xsl:call-template name="portlet-compile-error">
- <xsl:with-param name="errno">0100</xsl:with-param>
- <xsl:with-param name="errmsg">Unsupported logicsheet tag: <xsl:value-of select="local-name(.)"/></xsl:with-param>
- </xsl:call-template>
- </xsl:template>
- <xsl:template name="portlet-compile-error">
- <xsl:param name="errno"/>
- <xsl:param name="errmsg"/>
- <xsl:message>
- <xsl:text>CPS-ERR-</xsl:text>
- <xsl:value-of select="$errno"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="$errmsg"/>
- <xsl:text>.</xsl:text>
- </xsl:message>
- <xsl:message terminate="yes">
- <xsl:text> ...at: </xsl:text>
- <xsl:for-each select="ancestor-or-self::node()[name()!='']">
- <xsl:text>/</xsl:text>
- <xsl:value-of select="name()"/>
- </xsl:for-each>
- </xsl:message>
- </xsl:template>
- <xsl:template match="*|@*|text()|processing-instruction()" priority="-1">
- <xsl:copy>
- <xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|