| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632 |
- <?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: //cps4/8.1_NovRTM/src/cps/templates/cps4/portlets/portal-admin/portlet-impl/import/getMarkup.xts#1 $ -->
- <!-- $DateTime: 2005/10/21 13:51:27 $ -->
- <!-- $Change: 12585 $ -->
- <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <xts:block id="init" type="exec" mode="interpret" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <contentLocale>en</contentLocale>
- <xts:function name="getConfiguration">
- <xts:param name="contentLocales">en</xts:param>
- </xts:function>
- <!--
- <new_producers>
- <producer>
- <name>utility</name>
- </producer>
- </new_producers>
- <updated_producers>
- <producer>
- <name>nav</name>
- <currentPortlets>
- <handle>navigator</handle>
- <handle>search</handle>
- <handle>viewer</handle>
- </currentPortlets>
- </producer>
- </updated_producers>
- -->
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="producers" condition=".[/root/new_producers or /root/updated_producers]" dependency="init" type="exec" mode="interpret" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:variable name="content-locale" select="/root/contentLocale"/>
- <!--
- inquire request - retrieve list of installed producers
-
- root
- inquire
- services
- service
- id
- title
- namespace
- definition
- binding
- binding @name="WSRPService"
- port @name
- address @location
- resourceList
- resources
- values
- -->
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <inquire>
- <xts:request protocol="PRODUCERS" faultBlock="handleFault">
- <xts:param name="locale">
- <xsl:value-of select="$content-locale"/>
- </xts:param>
- <xsl:for-each select="/root/configuration/property[@name='contentLocales']/locale[id != $content-locale]">
- <xsl:sort select="id"/>
- <xts:param name="locale">
- <xsl:value-of select="id"/>
- </xts:param>
- </xsl:for-each>
- <xsl:for-each select="/root/new_producers/producer | /root/updated_producers/producer">
- <xts:param name="producer">
- <xsl:value-of select="name"/>
- </xts:param>
- </xsl:for-each>
- </xts:request>
- </inquire>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="binding" condition=".[/root/new_producers or /root/updated_producers]" dependency="producers" mandatory="false" type="exec" mode="interpret" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/" exclude-result-prefixes="wsrp wsdlsoap wsdl xtse">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:if test="/root/new_producers/producer or /root/updated_producers/producer">
- <xts:sequence>
- <xsl:for-each select="/root/new_producers/producer">
- <xsl:variable name="services" select="/root/inquire/services/service"/>
- <xsl:variable name="name" select="name"/>
- <xts:append select="/root/new_producers/producer[name='{$name}']">
- <binding>
- <xsl:variable name="service" select="$services[id =$name]"/>
- <xsl:variable name="binding" select="$service/binding/service[@name = 'WSRPService']"/>
- <xsl:call-template name="gen-wsdl">
- <xsl:with-param name="markup" select="$binding/port[@name = 'WSRPBaseService']/address/@location"/>
- <xsl:with-param name="description" select="$binding/port[@name = 'WSRPServiceDescriptionService']/address/@location"/>
- <xsl:with-param name="registration" select="$binding/port[@name = 'WSRPRegistrationService']/address/@location"/>
- <xsl:with-param name="management" select="$binding/port[@name = 'WSRPPortletManagementService']/address/@location"/>
- <xsl:with-param name="binding" select="$binding"/>
- </xsl:call-template>
- </binding>
- </xts:append>
- </xsl:for-each>
- <xsl:for-each select="/root/updated_producers/producer">
- <xsl:variable name="services" select="/root/inquire/services/service"/>
- <xsl:variable name="name" select="name"/>
- <xts:append select="/root/updated_producers/producer[name='{$name}']">
- <binding>
- <xsl:variable name="service" select="$services[id =$name]"/>
- <xsl:variable name="binding" select="$service/binding/service[@name = 'WSRPService']"/>
- <xsl:call-template name="gen-wsdl">
- <xsl:with-param name="markup" select="$binding/port[@name = 'WSRPBaseService']/address/@location"/>
- <xsl:with-param name="description" select="$binding/port[@name = 'WSRPServiceDescriptionService']/address/@location"/>
- <xsl:with-param name="registration" select="$binding/port[@name = 'WSRPRegistrationService']/address/@location"/>
- <xsl:with-param name="management" select="$binding/port[@name = 'WSRPPortletManagementService']/address/@location"/>
- <xsl:with-param name="binding" select="$binding"/>
- </xsl:call-template>
- </binding>
- </xts:append>
- </xsl:for-each>
- </xts:sequence>
- </xsl:if>
- </xsl:template>
- <xsl:template name="gen-wsdl">
- <xsl:param name="markup"/>
- <xsl:param name="description"/>
- <xsl:param name="registration"/>
- <xsl:param name="management"/>
- <xsl:param name="binding"/>
- <wsdl:definitions targetNamespace="urn:oasis:names:tc:wsrp:v1:wsdl"
- xmlns:bind="urn:oasis:names:tc:wsrp:v1:bind"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:import namespace="urn:oasis:names:tc:wsrp:v1:bind" location="http://www.oasis-open.org/committees/wsrp/specifications/version1/wsrp_v1_bindings.wsdl"/>
- <wsdl:service name="WSRPService">
- <xsl:apply-templates select="$binding/*[local-name()='segment']" mode="copy"/>
- <wsdl:port binding="bind:WSRP_v1_Markup_Binding_SOAP" name="WSRPBaseService">
- <wsdlsoap:address location="{ $markup }"/>
- <xsl:apply-templates select="$binding/*[local-name()='port' and @name='WSRPBaseService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- <wsdl:port binding="bind:WSRP_v1_ServiceDescription_Binding_SOAP" name="WSRPServiceDescriptionService">
- <wsdlsoap:address location="{ $description }"/>
- <xsl:apply-templates select="$binding/*[local-name()='port' and @name='WSRPServiceDescriptionService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- <xsl:if test="$registration != ''">
- <wsdl:port binding="bind:WSRP_v1_Registration_Binding_SOAP" name="WSRPRegistrationService">
- <wsdlsoap:address location="{ $registration }"/>
- <xsl:apply-templates select="$binding/*[local-name()='port' and @name='WSRPRegistrationService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- </xsl:if>
- <xsl:if test="$management != ''">
- <wsdl:port binding="bind:WSRP_v1_PortletManagement_Binding_SOAP" name="WSRPPortletManagementService">
- <wsdlsoap:address location="{ $management }"/>
- <xsl:apply-templates select="$binding/*[local-name()='port' and @name='WSRPPortletManagementService']/*[local-name()='portletAddress']" mode="copy"/>
- </wsdl:port>
- </xsl:if>
- </wsdl:service>
- </wsdl:definitions>
- </xsl:template>
- <!-- Using xsl:copy-of will sometime cause a namespace leak. To fix this, we use this template to copy the elements -->
- <xsl:template match="*" mode="copy">
- <xsl:element name="{name()}" namespace="{namespace-uri()}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="copy"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="text()" mode="copy">
- <xsl:value-of select="."/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="description" condition=".[/root/new_producers or /root/updated_producers]" dependency="binding" mandatory="false" type="exec" mode="interpret" processor="XSLT">
- <!--
- description
- - retrieve serviceDescription using producer binding
- -->
- <xts:logicsheet path="/cps4/common/logicsheets/soaplogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext wsrp wsdlsoap wsdl soap">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:if test="/root/new_producers/producer or /root/updated_producers/producer">
- <xts:sequence>
- <xsl:for-each select="/root/new_producers/producer">
- <xsl:variable name="name" select="name"/>
- <xsl:variable name="interface-description" select="binding/wsdl:definitions/wsdl:service[@name = 'WSRPService']/wsdl:port[@name = 'WSRPServiceDescriptionService']/wsdlsoap:address/@location"/>
- <xts:append select="/root/new_producers/producer[name='{$name}']">
- <description>
- <soap:request target="{ $interface-description }" soapAction="urn:oasis:names:tc:wsrp:v1:getServiceDescription" faultBlock="handleFault">
- <wsrp:getServiceDescription xmlns:m="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <wsrp:registrationContext xsi:nil="true"/>
- <xsl:variable name="locale">
- <xsl:choose>
- <xsl:when test="/root/contentLocale">
- <xsl:value-of select="/root/contentLocale"/>
- </xsl:when>
- <xsl:otherwise>en</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <wsrp:desiredLocales>
- <xsl:value-of select="$locale"/>
- </wsrp:desiredLocales>
- <xsl:for-each select="/root/configuration/property[@name='contentLocales']/locale[id != $locale]">
- <xsl:sort select="id"/>
- <wsrp:desiredLocales>
- <xsl:value-of select="id"/>
- </wsrp:desiredLocales>
- </xsl:for-each>
- </wsrp:getServiceDescription>
- </soap:request>
- </description>
- </xts:append>
- </xsl:for-each>
- <xsl:for-each select="/root/updated_producers/producer">
- <xsl:variable name="name" select="name"/>
- <xsl:variable name="binding" select="binding/wsdl:definitions"/>
- <xsl:variable name="interface-description" select="binding/wsdl:definitions/wsdl:service[@name = 'WSRPService']/wsdl:port[@name = 'WSRPServiceDescriptionService']/wsdlsoap:address/@location"/>
- <xts:append select="/root/updated_producers/producer[name='{$name}']">
- <description>
- <soap:request target="{ $interface-description }" soapAction="urn:oasis:names:tc:wsrp:v1:getServiceDescription" faultBlock="handleFault">
- <wsrp:getServiceDescription xmlns:m="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <wsrp:registrationContext>
- <xsl:copy-of select="*[local-name()='registration']/*[local-name() = 'RegistrationContext']/*"/>
- </wsrp:registrationContext>
- <xsl:variable name="locale">
- <xsl:choose>
- <xsl:when test="/root/contentLocale">
- <xsl:value-of select="/root/contentLocale"/>
- </xsl:when>
- <xsl:otherwise>en</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <wsrp:desiredLocales>
- <xsl:value-of select="$locale"/>
- </wsrp:desiredLocales>
- <xsl:for-each select="/root/configuration/property[@name='contentLocales']/locale[id != $locale]">
- <xsl:sort select="id"/>
- <wsrp:desiredLocales>
- <xsl:value-of select="id"/>
- </wsrp:desiredLocales>
- </xsl:for-each>
- </wsrp:getServiceDescription>
- </soap:request>
- </description>
- </xts:append>
- </xsl:for-each>
- </xts:sequence>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="register" condition=".[/root/new_producers]" dependency="description" mandatory="false" type="exec" mode="interpret" processor="XSLT">
- <xts:logicsheet path="/cps4/common/logicsheets/soaplogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="SOAP-ENV wsrp wsdlsoap xsi wsdl soap xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:if test="/root/new_producers/producer">
- <xts:sequence>
- <xsl:for-each select="/root/new_producers/producer">
- <xsl:variable name="name" select="name"/>
- <xsl:variable name="description" select="description/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
- <xsl:variable name="interface-registration" select="binding/wsdl:definitions/wsdl:service[@name = 'WSRPService']/wsdl:port[@name = 'WSRPRegistrationService']/wsdlsoap:address/@location"/>
- <xsl:variable name="registration-required" select="$description/wsrp:requiresRegistration[. = 'true' or . = '1']"/>
- <xsl:variable name="registration-properties" select="$description/wsrp:registrationPropertyDescription/wsrp:propertyDescriptions"/>
- <xsl:if test="$registration-required">
- <xts:append select="/root/new_producers/producer[name='{$name}']">
- <registration>
- <soap:request target="{ $interface-registration }" soapAction="urn:oasis:names:tc:wsrp:v1:register" faultBlock="handleFault">
- <wsrp:register xmlns:m="urn:oasis:names:tc:wsrp:v1:types">
- <wsrp:consumerName>Cognos WSRP Portal</wsrp:consumerName>
- <wsrp:consumerAgent>Cognos.Connection.2.0</wsrp:consumerAgent>
- <wsrp:methodGetSupported>true</wsrp:methodGetSupported>
- <wsrp:consumerModes>wsrp:view</wsrp:consumerModes>
- <wsrp:consumerModes>wsrp:edit</wsrp:consumerModes>
- <wsrp:consumerModes>wsrp:preview</wsrp:consumerModes>
- <wsrp:consumerModes>wsrp:help</wsrp:consumerModes>
- <wsrp:consumerWindowStates>wsrp:normal</wsrp:consumerWindowStates>
- <wsrp:consumerWindowStates>wsrp:maximized</wsrp:consumerWindowStates>
- <wsrp:consumerWindowStates>wsrp:minimized</wsrp:consumerWindowStates>
- <xsl:for-each select="$registration-properties">
- <wsrp:registrationProperties name="{ @name }" xml:lang="en">
- <wsrp:stringValue>
- <xsl:value-of select="''"/>
- </wsrp:stringValue>
- </wsrp:registrationProperties>
- </xsl:for-each>
- </wsrp:register>
- </soap:request>
- </registration>
- </xts:append>
- </xsl:if>
- </xsl:for-each>
- </xts:sequence>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="description2" dependency="register" condition=".[/root/new_producers/producer/registration]" mandatory="false" type="exec" mode="interpret" processor="XSLT">
- <!--
- description2
- - replace service description with new one using registration context
- NOTE: This block will execute if a new registration was created without any errors.
- -->
- <xts:logicsheet path="/cps4/common/logicsheets/soaplogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/" exclude-result-prefixes="SOAP-ENV wsrp wsdlsoap xsi wsdl soap xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:if test="/root/new_producers/producer">
- <xts:sequence>
- <xsl:for-each select="/root/new_producers/producer">
- <xsl:if test="registration and not(registration/xtse:error)">
- <xsl:variable name="name" select="name"/>
- <xsl:variable name="interface-description" select="binding/wsdl:definitions/wsdl:service[@name = 'WSRPService']/wsdl:port[@name = 'WSRPServiceDescriptionService']/wsdlsoap:address/@location"/>
- <xts:replace select="/root/new_producers/producer[name='{$name}']/description">
- <description>
- <soap:request target="{ $interface-description }" soapAction="urn:oasis:names:tc:wsrp:v1:getServiceDescription" faultBlock="handleFault">
- <wsrp:getServiceDescription xmlns:m="urn:oasis:names:tc:wsrp:v1:types">
- <wsrp:registrationContext>
- <xsl:copy-of select="registration/*[local-name() = 'Envelope']/*[local-name() = 'Body']/*[local-name() = 'registerResponse']/*"/>
- </wsrp:registrationContext>
- <xsl:variable name="locale">
- <xsl:choose>
- <xsl:when test="/root/contentLocale">
- <xsl:value-of select="/root/contentLocale"/>
- </xsl:when>
- <xsl:otherwise>en</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <wsrp:desiredLocales>
- <xsl:value-of select="$locale"/>
- </wsrp:desiredLocales>
- <xsl:for-each select="/root/configuration/property[@name='contentLocales']/locale[id != $locale]">
- <xsl:sort select="id"/>
- <wsrp:desiredLocales>
- <xsl:value-of select="id"/>
- </wsrp:desiredLocales>
- </xsl:for-each>
- </wsrp:getServiceDescription>
- </soap:request>
- </description>
- </xts:replace>
- </xsl:if>
- </xsl:for-each>
- </xts:sequence>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="create" dependency="description2" mandatory="false" type="exec" mode="interpret" processor="XSLT">
-
- <xts:logicsheet path="/cps4/common/logicsheets/soaplogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/" xmlns:ast="http://developer.cognos.com/schemas/cps/asm/storage/1/" xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/" exclude-result-prefixes="wsdlsoap soap xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:if test="/root/new_producers/producer or /root/updated_producers/producer">
- <xts:sequence>
-
- <xsl:for-each select="/root/updated_producers/producer">
- <xsl:if test="not(binding/xtse:error) and not(description/xtse:error)">
- <xsl:variable name="name" select="name"/>
- <xsl:variable name="description" select="description/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
- <xsl:variable name="current-portlets" select="currentPortlets/handle"/>
- <xsl:variable name="resource-list" select="$description/wsrp:resourceList/wsrp:resources"/>
-
- <xts:append select="/root/updated_producers/producer[name='{$name}']">
- <newPortlets>
- <xsl:variable name="portlets" select="$description/wsrp:offeredPortlets[not (wsrp:portletHandle = $current-portlets)]"/>
- <xsl:for-each select="$portlets">
- <xsl:variable name="duplicates" select="count($description/wsrp:offeredPortlets[wsrp:title/wsrp:value = current()/wsrp:title/wsrp:value]) - count($portlets[wsrp:title/wsrp:value = current()/wsrp:title/wsrp:value]) + position() - 1"/>
- <cps:portlet>
- <cps:name>
- <xsl:if test="wsrp:title/@resourceName">
- <xsl:attribute name="resourceName">
- <xsl:value-of select="wsrp:title/@resourceName"/>
- <xsl:if test="$duplicates > 0">
- <xsl:value-of select="concat(' _', $duplicates)"/>
- </xsl:if>
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="wsrp:title/@xml:lang"/>
-
- <xsl:value-of select="wsrp:title/wsrp:value"/>
- <xsl:if test="$duplicates > 0">
- <xsl:value-of select="concat(' (', $duplicates, ')')"/>
- </xsl:if>
- </cps:name>
- <cps:description>
- <xsl:copy-of select="wsrp:description/@xml:lang | wsrp:description/@resourceName"/>
- <xsl:value-of select="wsrp:description/wsrp:value"/>
- </cps:description>
- <cps:handle>
- <xsl:value-of select="wsrp:portletHandle"/>
- </cps:handle>
- </cps:portlet>
- </xsl:for-each>
-
- <cps:resourceList>
- <!-- portlet strings -->
- <xsl:for-each select="$portlets">
- <xsl:variable name="duplicates" select="count($description/wsrp:offeredPortlets[wsrp:title/wsrp:value = current()/wsrp:title/wsrp:value]) - count($portlets[wsrp:title/wsrp:value = current()/wsrp:title/wsrp:value]) + position() - 1"/>
- <xsl:for-each select="wsrp:title | wsrp:description">
- <xsl:variable name="is-title" select="local-name() = 'title'"/>
- <xsl:if test="@resourceName">
- <xsl:variable name="resource-name">
- <xsl:value-of select="@resourceName"/>
- <xsl:if test="$is-title and $duplicates > 0">
- <xsl:value-of select="concat(' _', $duplicates)"/>
- </xsl:if>
- </xsl:variable>
- <cps:resources resourceName="{ $resource-name }">
- <xsl:variable name="resource" select="$resource-list[@resourceName = current()/@resourceName]"/>
- <xsl:for-each select="$resource/wsrp:values">
- <cps:values xml:lang="{ @xml:lang }">
- <xsl:value-of select="wsrp:value"/>
- <xsl:if test="$is-title and $duplicates > 0">
- <xsl:value-of select="concat(' (', $duplicates , ')')"/>
- </xsl:if>
- </cps:values>
- </xsl:for-each>
- </cps:resources>
- </xsl:if>
- </xsl:for-each>
- </xsl:for-each>
- </cps:resourceList>
- </newPortlets>
- </xts:append>
- </xsl:if>
- </xsl:for-each>
-
- <xsl:for-each select="/root/new_producers/producer">
- <xsl:if test="not(binding/xtse:error) and not(description/xtse:error) and not(registration/xtse:error)">
- <xsl:variable name="name" select="name"/>
- <xsl:variable name="binding" select="binding/wsdl:definitions"/>
- <xsl:variable name="description" select="description/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]"/>
- <xsl:variable name="resource-list" select="$description/wsrp:resourceList/wsrp:resources"/>
- <xsl:variable name="registration-handle" select="registration/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]/wsrp:registrationHandle"/>
- <xsl:variable name="registration-state" select="registration/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]/wsrp:registrationState"/>
- <xsl:variable name="registration-extensions" select="registration/SOAP-ENV:Envelope/SOAP-ENV:Body/*[1]/wsrp:extensions"/>
- <xsl:variable name="services" select="/root/inquire/services/service"/>
- <xsl:variable name="service" select="$services[id = $name]"/>
- <xts:append select="/root/new_producers/producer[name='{$name}']">
- <create>
- <ast:savePortletProducer xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/" xmlns:ast="http://developer.cognos.com/schemas/cps/asm/storage/1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <cps:path>/connection</cps:path>
- <cps:portletProducer>
- <cps:name>
- <xsl:copy-of select="$service/title/@*"/>
- <xsl:value-of select="$service/title"/>
- </cps:name>
- <cps:description>
- <xsl:copy-of select="$description/title/@*"/>
- <xsl:value-of select="$description/title"/>
- </cps:description>
- <cps:screenTip>
- <xsl:copy-of select="$service/screenTip/@*"/>
- <xsl:value-of select="$service/screenTip"/>
- </cps:screenTip>
- <cps:binding>
- <cps:service name="WSRPService">
- <xsl:apply-templates select="$binding/wsdl:service[@name = 'WSRPService']/*[name() != 'wsdl:port']" mode="copy"/>
- <xsl:copy-of select="$binding/wsdl:service[@name = 'WSRPService']/wsdl:port"/>
- </cps:service>
- </cps:binding>
- <xsl:if test="$registration-handle != ''">
- <cps:registration>
- <wsrp:RegistrationContext>
- <wsrp:registrationHandle>
- <xsl:value-of select="$registration-handle"/>
- </wsrp:registrationHandle>
- <xsl:if test="$registration-state != ''">
- <wsrp:registrationState>
- <xsl:value-of select="$registration-state"/>
- </wsrp:registrationState>
- </xsl:if>
- <xsl:copy-of select="$registration-extensions"/>
- </wsrp:RegistrationContext>
- </cps:registration>
- </xsl:if>
- <cps:serviceDescription xmlns="urn:oasis:names:tc:wsrp:v1:types">
- <xsl:copy-of select="$description/*"/>
- </cps:serviceDescription>
- <!--
- construct portlet name and descriptionfrom wsrp resourceList
-
- wsrp:resourceList
- wsrp:resources @resourceName
- wsrp:values @xml:lang
- wsrp:value
-
- cps:resourceList
- cps:resources @resourceName
- cps:values @xml:lang
-
- -->
- <xsl:variable name="portlets" select="$description/wsrp:offeredPortlets"/>
- <xsl:for-each select="$portlets">
- <xsl:variable name="duplicates" select="count(preceding-sibling::wsrp:offeredPortlets[wsrp:title/wsrp:value = current()/wsrp:title/wsrp:value])"/>
- <cps:portlet>
- <cps:name>
- <xsl:if test="wsrp:title/@resourceName">
- <xsl:attribute name="resourceName">
- <xsl:value-of select="wsrp:title/@resourceName"/>
- <xsl:if test="$duplicates > 0">
- <xsl:value-of select="concat(' _', $duplicates)"/>
- </xsl:if>
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="wsrp:title/@xml:lang"/>
- <xsl:value-of select="wsrp:title/wsrp:value"/>
- <xsl:if test="$duplicates > 0">
- <xsl:value-of select="concat(' (', $duplicates , ')')"/>
- </xsl:if>
- </cps:name>
- <cps:description>
- <xsl:copy-of select="wsrp:description/@xml:lang | wsrp:description/@resourceName"/>
- <xsl:value-of select="wsrp:description/wsrp:value"/>
- </cps:description>
- <cps:handle>
- <xsl:value-of select="wsrp:portletHandle"/>
- </cps:handle>
- </cps:portlet>
- </xsl:for-each>
- <!-- resourceList -->
- <cps:resourceList>
- <!-- portletProducer strings -->
- <xsl:for-each select="$service/title | $service/description | $service/screenTip">
- <xsl:if test="@resourceName">
- <cps:resources resourceName="{ @resourceName }">
- <xsl:variable name="resource" select="$service/resourceList/resources[@resourceName = current()/@resourceName]"/>
- <xsl:for-each select="$resource/values">
- <cps:values xml:lang="{ @xml:lang }">
- <xsl:value-of select="."/>
- </cps:values>
- </xsl:for-each>
- </cps:resources>
- </xsl:if>
- </xsl:for-each>
- <!-- portlet strings -->
- <xsl:for-each select="$portlets">
- <xsl:variable name="duplicates" select="count(preceding-sibling::wsrp:offeredPortlets[wsrp:title/wsrp:value = current()/wsrp:title/wsrp:value])"/>
- <xsl:for-each select="wsrp:title | wsrp:description">
- <xsl:variable name="is-title" select="local-name() = 'title'"/>
- <xsl:if test="@resourceName">
- <xsl:variable name="resource-name">
- <xsl:value-of select="@resourceName"/>
- <xsl:if test="$is-title and $duplicates > 0">
- <xsl:value-of select="concat(' _', $duplicates)"/>
- </xsl:if>
- </xsl:variable>
- <cps:resources resourceName="{ $resource-name }">
- <xsl:variable name="resource" select="$resource-list[@resourceName = current()/@resourceName]"/>
- <xsl:for-each select="$resource/wsrp:values">
- <cps:values xml:lang="{ @xml:lang }">
- <xsl:value-of select="wsrp:value"/>
- <xsl:if test="$is-title and $duplicates > 0">
- <xsl:value-of select="concat(' (', $duplicates, ')')"/>
- </xsl:if>
- </cps:values>
- </xsl:for-each>
- </cps:resources>
- </xsl:if>
- </xsl:for-each>
- </xsl:for-each>
- </cps:resourceList>
- </cps:portletProducer>
- </ast:savePortletProducer>
- </create>
- </xts:append>
- </xsl:if>
- </xsl:for-each>
- </xts:sequence>
- </xsl:if>
- </xsl:template>
- <!-- Using xsl:copy-of will sometime cause a namespace leak. To fix this, we use this template to copy the elements -->
- <xsl:template match="*" mode="copy">
- <xsl:element name="{name()}" namespace="{namespace-uri()}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="copy"/>
- </xsl:element>
- </xsl:template>
- <xsl:template match="text()" mode="copy">
- <xsl:value-of select="."/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- <xts:block id="test" dependency="create" mode="output" processor="XSLT" type="exec" mimeType="text/xml" >
- <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:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:pm="http://developer.cognos.com/schemas/xts/pm" xmlns:mt="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mt" xmlns:mf="http://developer.cognos.com/schemas/xts/logicsheets/presentation/main/mf" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:out="http://www.w3.org/1999/XSL/Transform" xmlns:pg="http://developer.cognos.com/schemas/xts/pg" xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/" xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" exclude-result-prefixes="xsl cm cml pf mt mf xts xtsext cf cp out bus utml dp lyt pm">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:copy-of select="/root"/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- -->
- <xts:block id="handleFault" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xtse:error>
- <xsl:for-each select="/root/fault/xts:exception[not(starts-with(xts:exceptionCode, 'java'))]">
- <xtse:message>
- <xsl:value-of select="xts:exceptionMsg"/>
- </xtse:message>
- </xsl:for-each>
- </xtse:error>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|