123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2014
- 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).
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml" requiredCapability="canUseDataSourcesTool">
- <xts:block id="loadMetadata" type="exec" mode="interpret" processor="XML" nodelist="">
- <xts:sequence>
- <xts:append>
- <xts:transform src="/transforms/portal/dataSource/generateDatasourceMetadata.xslt" processor="XSLT">
- <xts:param name="messageBase">/messages/portal.xml</xts:param>
- <root/>
- </xts:transform>
- <installedComponents>
- <xts:function name="getConfiguration">
- <xts:param name="installedComponents"/>
- </xts:function>
- </installedComponents>
- </xts:append>
- </xts:sequence>
- </xts:block>
-
- <xts:block id="splitConnectionString" dependency="loadMetadata" processor="XSLT" type="exec" nodelist="datasources,command">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:test="http://developer.cognos.com/schemas/xts/portal/iTestDataSource/1/"
- exclude-result-prefixes="xsl test">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:key name="connectionMetadata" match="/root/datasources/datasource" use="code"/>
-
- <xsl:template match="/root">
- <xts:sequence>
- <xts:replace select="/root/command/*/connectionString">
- <xsl:for-each select="/root/command/*/connectionString">
- <xsl:call-template name="split-connectionString">
- <xsl:with-param name="connectionString" select="."/>
- </xsl:call-template>
- </xsl:for-each>
- </xts:replace>
- </xts:sequence>
- </xsl:template>
-
- <xsl:template name="split-connectionString">
- <xsl:param name="connectionString"/>
-
- <xsl:variable name="seperatorSequence" select="'IBM_JD_CNX_STR:'"/>
- <!-- Split the connection strings -->
- <xsl:variable name="firstPart">
- <xsl:choose>
- <xsl:when test="contains($connectionString, $seperatorSequence)">
- <xsl:value-of select="substring-before($connectionString, $seperatorSequence)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$connectionString"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="secondPart">
- <xsl:value-of select="substring-after($connectionString, $seperatorSequence)"/>
- </xsl:variable>
- <!-- Lookup the metadata for each connection string -->
- <xsl:variable name="firstPart-metadata">
- <xsl:call-template name="get-metadataEntry">
- <xsl:with-param name="connectionString" select="$firstPart"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="secondPart-metadata">
- <xsl:call-template name="get-metadataEntry">
- <xsl:with-param name="connectionString" select="$secondPart"/>
- </xsl:call-template>
- </xsl:variable>
- <!-- Generate the replacement connectionString elements using information from the metadata -->
- <xsl:if test="$firstPart-metadata">
- <xsl:for-each select="$firstPart-metadata/datasource/testConnectionProvider">
- <connectionString target="{string(.)}" code="{$firstPart-metadata/datasource/code}">
- <xsl:value-of select="$firstPart"/>
- </connectionString>
- </xsl:for-each>
- </xsl:if>
- <xsl:if test="$secondPart != ''">
- <xsl:for-each select="$secondPart-metadata/datasource/testConnectionProvider">
- <connectionString target="{string(.)}" code="{$secondPart-metadata/datasource/code}">
- <xsl:value-of select="$secondPart"/>
- </connectionString>
- </xsl:for-each>
- </xsl:if>
- </xsl:template>
- <!-- looks up the metadata entry for the specified connection string. -->
- <xsl:template name="get-metadataEntry">
- <xsl:param name="connectionString"/>
- <xsl:if test="$connectionString != ''">
- <xsl:variable name="connectionType" select="substring-before(substring-after($connectionString, ';LOCAL;'),';')"/>
- <xsl:choose>
- <xsl:when test="key('connectionMetadata',$connectionType)[not(patternMatch)]">
- <xsl:copy-of select="key('connectionMetadata',$connectionType)[testConnectionProvider]"/>
- </xsl:when>
- <xsl:when test="count(key('connectionMetadata',$connectionType)[patternMatch])>0">
- <xsl:for-each select="key('connectionMetadata',$connectionType)[testConnectionProvider and patternMatch]">
- <xsl:choose>
- <xsl:when test="patternMatch/@match='contains' and contains($connectionString, patternMatch)">
- <xsl:copy-of select="."/>
- </xsl:when>
- <xsl:when test="patternMatch/@match='excludes' and not(contains($connectionString, patternMatch))">
- <xsl:copy-of select="."/>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:when test="count(key('connectionMetadata',substring-before($connectionType,'-')))=1">
- <!-- A special case for generic jdbc. The generic jdbc data source use the code JDBC, but each sub-type uses it's own code like JDBC-XX. -->
- <xsl:copy-of select="key('connectionMetadata',substring-before($connectionType,'-'))[testConnectionProvider]"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- We don't know the type, so generate metadata that will cause it to be tested on both stacks -->
- <datasource>
- <code><xsl:value-of select="$connectionType"/></code>
- <testConnectionProvider>metadataService</testConnectionProvider>
- <testConnectionProvider>queryService</testConnectionProvider>
- </datasource>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="getDispatcherDetails" processor="XSLT" type="exec" condition="count(/root/command/*[local-name()='testDataSourceConnection']/dispatcher) > 0" mandatory="false">
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:template match="/">
- <xts:sequence>
- <xts:append>
- <content>
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm">
- <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
- <!-- We need dispatchers that use the metadataService separately from those that use the query service -->
- <cm:query>
- <cm:requests>
- <cm:query>
- <cm:search>/configuration//*[@objectClass='metadataService']/parent::*</cm:search>
- <cm:properties>
- <cm:property name="defaultName"/>
- <cm:property name="ancestors"/>
- <cm:property name="dispatcherID"/>
- <cm:property name="iconURI"/>
- <cm:property name="defaultScreenTip"/>
- </cm:properties>
- </cm:query>
- <cm:query>
- <cm:search>/configuration//*[@objectClass='queryService']/parent::*</cm:search>
- <cm:properties>
- <cm:property name="defaultName"/>
- <cm:property name="ancestors"/>
- <cm:property name="dispatcherID"/>
- <cm:property name="iconURI"/>
- <cm:property name="defaultScreenTip"/>
- </cm:properties>
- </cm:query>
- <cm:query>
- <cm:search>/configuration//*[@objectClass='contentManagerService']/parent::*</cm:search>
- <cm:properties>
- <cm:property name="defaultName"/>
- <cm:property name="ancestors"/>
- <cm:property name="dispatcherID"/>
- <cm:property name="iconURI"/>
- <cm:property name="defaultScreenTip"/>
- </cm:properties>
- </cm:query>
- </cm:requests>
- </cm:query>
- </xts:transform>
- </send:request>
- </xts:transform>
- </content>
- </xts:append>
- <!-- Historically, when displaying the path to the dispather we do not include the Configuration object. -->
- <xts:delete select="/root/content/*[local-name() = 'queryResponse']/*[local-name()='queryReply']/*[local-name() = 'dispatcher']/*[local-name() = 'ancestors']/*[local-name() = 'ancestorInfo'][1]"/>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="doTest" processor="XSLT" type="exec" dependency="splitConnectionString getDispatcherDetails">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
- <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:test="http://developer.cognos.com/schemas/xts/portal/iTestDataSource/1/"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- 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:md1="http://developer.cognos.com/schemas/metadataService/1"
- xmlns:qs1="http://developer.cognos.com/schemas/queryService/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="xts xsl pf test send md1 qs1 xsi bus cm cf cp xtsext">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <xsl:key name="dispatchers" match="/root/content/cm:queryResponse/cm:queryReply/cm:dispatcher" use="cm:dispatcherID"/>
- <xsl:key name="mdsDispatchers" match="/root/content/cm:queryResponse/cm:queryReply[1]/cm:dispatcher" use="cm:dispatcherID"/>
- <xsl:key name="qsDispatchers" match="/root/content/cm:queryResponse/cm:queryReply[2]/cm:dispatcher" use="cm:dispatcherID"/>
- <xsl:key name="cmDispatchers" match="/root/content/cm:queryResponse/cm:queryReply[3]/cm:dispatcher" use="cm:dispatcherID"/>
- <xsl:key name="connectionMetadata" match="/root/datasources/datasource[testConnectionProvider]" use="code"/>
- <xsl:variable name="queryServiceIsInstalled" select="/root/installedComponents/configuration/property/component[string(.)='queryService']"/>
- <pf:variables/>
-
- <xsl:template match="/root">
- <xsl:variable name="connectionStrings" select="command/test:testDataSourceConnection/connectionString"/>
- <xsl:variable name="dispatchers" select="command/test:testDataSourceConnection/dispatcher"/>
- <xsl:variable name="credentials" select="command/test:testDataSourceConnection/credentials"/>
-
- <xts:sequence>
- <xts:append>
- <testResults>
- <xsl:for-each select="$connectionStrings">
- <xsl:variable name="connectionString" select="."/>
- <xsl:variable name="target" select="$connectionString/@target"/>
- <xsl:if test="$target != 'queryService' or $queryServiceIsInstalled">
- <xsl:choose>
- <xsl:when test="$dispatchers[@id != '']">
- <xsl:for-each select="$dispatchers[@id != '']">
- <dispatcher id="{@id}">
- <connectionString><xsl:value-of select="$connectionString"/></connectionString>
- <displayName><xsl:value-of select="key('dispatchers', @id)[1]/cm:defaultName"/></displayName>
- <displayPath>
- <cf:do-the-path-link>
- <cf:param name="familytree">key('dispatchers', @id)[1]/cm:ancestors</cf:param>
- <cf:param name="familymember">key('dispatchers', @id)[1]/cm:defaultName</cf:param>
- <cf:param name="onlyAncestors">true</cf:param>
- </cf:do-the-path-link>
- </displayPath>
- <displayIcon>
- <xsl:call-template name="gen-dispatcher-icon">
- <xsl:with-param name="id" select="@id"/>
- </xsl:call-template>
- </displayIcon>
- <displayScreenTip>
- <xsl:value-of select="key('dispatchers', @id)[1]/cm:defaultName"/>
- <xsl:if test="key('dispatchers', @id)[1]/cm:defaultScreenTip != '' ">
- <xsl:text/> - <xsl:value-of select="key('dispatchers', @id)[1]/cm:defaultScreenTip"/>
- </xsl:if>
- </displayScreenTip>
- <connectionType>
- <xsl:call-template name="gen-displayType">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- </xsl:call-template>
- </connectionType>
- <xsl:choose>
- <xsl:when test="$target='metadataService'">
- <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_CLASSIC"/></connectionStack>
- <send:request provider="metadataService" affinity=".server" faultBlock="faultHandler" directedRequest="@id">
- <xsl:call-template name="buildTestConnectionRequestWrapper">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- </send:request>
- </xsl:when>
- <xsl:when test="$target='queryService'">
- <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_V5"/></connectionStack>
- <send:request provider="queryService" affinity=".server" faultBlock="faultHandler" directedRequest="@id">
- <xsl:call-template name="buildTestConnectionRequestWrapper">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- </send:request>
- </xsl:when>
- <xsl:when test="$target='contentManagerService'">
- <xsl:choose>
- <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.fileSystemPlugin.FileSystemArchivePlugin')">
- <connectionStack><xts:string id="IDS_PROP_CONN_FILESYSTEM"/></connectionStack>
- </xsl:when>
- <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.CMISRepository.CMISRepositoryPlugin')">
- <xsl:choose>
- <xsl:when test="contains($connectionString, 'PROVIDER=CM8')">
- <connectionStack><xts:string id="IDS_PROP_CONN_CM"/></connectionStack>
- </xsl:when>
- <xsl:otherwise>
- <connectionStack><xts:string id="IDS_PROP_CONN_FILENET"/></connectionStack>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_REPOSITORY"/></connectionStack>
- </xsl:otherwise>
- </xsl:choose>
- <send:request provider="cm" faultBlock="faultHandler">
- <xsl:call-template name="buildTestConnectionRequestWrapper">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- </send:request>
- </xsl:when>
- </xsl:choose>
- </dispatcher>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <dispatcher>
- <connectionString><xsl:value-of select="$connectionString"/></connectionString>
- <connectionType>
- <xsl:call-template name="gen-displayType">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- </xsl:call-template>
- </connectionType>
- <xsl:choose>
- <xsl:when test="$connectionString/@target='metadataService'">
- <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_CLASSIC"/></connectionStack>
- <send:request provider="metadataService" faultBlock="faultHandler">
- <xsl:call-template name="buildTestConnectionRequestWrapper">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- </send:request>
- </xsl:when>
- <xsl:when test="$connectionString/@target='queryService'">
- <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_V5"/></connectionStack>
- <send:request provider="queryService" faultBlock="faultHandler">
- <xsl:call-template name="buildTestConnectionRequestWrapper">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- </send:request>
- </xsl:when>
- <xsl:when test="$connectionString/@target='contentManagerService'">
- <xsl:choose>
- <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.fileSystemPlugin.FileSystemArchivePlugin')">
- <connectionStack><xts:string id="IDS_PROP_CONN_FILESYSTEM"/></connectionStack>
- </xsl:when>
- <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.CMISRepository.CMISRepositoryPlugin')">
- <xsl:choose>
- <xsl:when test="contains($connectionString, 'PROVIDER=CM8')">
- <connectionStack><xts:string id="IDS_PROP_CONN_CM"/></connectionStack>
- </xsl:when>
- <xsl:otherwise>
- <connectionStack><xts:string id="IDS_PROP_CONN_FILENET"/></connectionStack>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_REPOSITORY"/></connectionStack>
- </xsl:otherwise>
- </xsl:choose>
- <send:request provider="contentManagerService" faultBlock="faultHandler">
- <xsl:call-template name="buildTestConnectionRequestWrapper">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- </send:request>
- </xsl:when>
- </xsl:choose>
- </dispatcher>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </xsl:for-each>
- </testResults>
- </xts:append>
- </xts:sequence>
- </xsl:template>
-
- <xsl:template name="buildTestConnectionRequestWrapper">
- <xsl:param name="connectionString"/>
- <xsl:param name="credentials"/>
- <xsl:param name="target"/>
- <!-- The preferred way would be to use <xsl:element namespace="TARGET NAMESPACE"/>, but a
- jd bug prevents us from using it because child nodes end up in null namespace. -->
- <xsl:choose>
- <xsl:when test="$target = 'metadataService'">
- <md1:testDataSourceConnection>
- <xsl:call-template name="buildTestConnectionRequest">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- </xsl:call-template>
- </md1:testDataSourceConnection>
- </xsl:when>
- <xsl:when test="$target = 'queryService'">
- <qs1:testDataSourceConnectionWithInfo>
- <xsl:call-template name="buildTestConnectionRequest">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- </xsl:call-template>
- </qs1:testDataSourceConnectionWithInfo>
- </xsl:when>
- <xsl:when test="$target = 'contentManagerService'">
- <bus:testDataSourceConnection>
- <xsl:call-template name="buildTestConnectionRequest">
- <xsl:with-param name="connectionString" select="$connectionString"/>
- <xsl:with-param name="credentials" select="$credentials"/>
- </xsl:call-template>
- </bus:testDataSourceConnection>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="buildTestConnectionRequest">
- <xsl:param name="connectionString"/>
- <xsl:param name="credentials"/>
- <connectionString xsi:type="xsd:string">
- <xsl:value-of select="$connectionString"/>
- <!--
- if we're testing an XML connection we need to add validate=on to the connection string. That
- how it's documented in docs. Trakker bug 480520
- -->
- <xsl:if test="contains($connectionString, ';LOCAL;XML;')">
- <xsl:text>;validate=on</xsl:text>
- </xsl:if>
- </connectionString>
- <credentials xsi:type="bus:xmlEncodedXML">
- <xsl:value-of select="$credentials"/>
- </credentials>
- </xsl:template>
- <!-- this is a simplified version of gen-icon that works just for dispatchers. It also generates just the iconURI instead of the whole img tag. -->
- <xsl:template name="gen-dispatcher-icon">
- <xsl:param name="id"/>
- <xsl:variable name="cmIconURI" select="string(key('dispatchers', $id)[1]/cm:iconURI)"/>
- <xsl:choose>
- <xsl:when test="$cmIconURI != ''">
- <xsl:choose>
- <!-- Ignore external URLs -->
- <xsl:when test="contains($cmIconURI,':/') or contains($cmIconURI,'\\') or contains($cmIconURI,'//')">
- <!-- blank -->
- </xsl:when>
- <!-- Relative / Absolute URLs - Checking for \ is probably useless in this case -->
- <xsl:when test="contains($cmIconURI, '/') or contains($cmIconURI, '\')">
- <xsl:choose>
- <!-- Doesn't start with / -->
- <xsl:when test="not(starts-with($cmIconURI, '/'))">
- <xsl:value-of select="$webRoot"/>/<xsl:value-of select="$cmIconURI"/>
- </xsl:when>
- <!-- Starts with / -->
- <xsl:otherwise>
- <xsl:value-of select="$webRoot"/><xsl:value-of select="$cmIconURI"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- image file -->
- <xsl:otherwise>
- <xsl:value-of select="$image_root"/><xsl:value-of select="$cmIconURI"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat($image_root, 'icon_', key( 'ui-object', key('dispatchers', $id)[1]/cm:objectClass )/@icon,'.gif')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- Searches the metadata for the type name for the provided connection string. -->
- <xsl:template name="gen-displayType">
- <xsl:param name="connectionString"/>
-
- <xsl:choose>
- <xsl:when test="count(key('connectionMetadata',$connectionString/@code))=1">
- <xsl:value-of select="key('connectionMetadata',$connectionString/@code)/name"/>
- </xsl:when>
- <xsl:when test="count(key('connectionMetadata',$connectionString/@code)[patternMatch])>0">
- <xsl:for-each select="key('connectionMetadata',$connectionString/@code)[patternMatch]">
- <xsl:choose>
- <xsl:when test="patternMatch/@match='contains' and contains($connectionString, patternMatch)">
- <xsl:text/><xsl:value-of select="name"/><xsl:text/>
- </xsl:when>
- <xsl:when test="patternMatch/@match='excludes' and not(contains($connectionString, patternMatch))">
- <xsl:text/><xsl:value-of select="name"/><xsl:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise><xts:string ID="IDS_TEST_CONNECTION_TYPE_UNKNOWN"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <!--
- ===============================================================================================
- Fault handler
- ===============================================================================================
- -->
- <xts:block id="faultHandler" type="fault" processor="XSLT">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- exclude-result-prefixes="xsl bus">
- <xsl:output method="xml"/>
- <xsl:template match="/root/fault">
- <errors>
- <xsl:for-each select="xts:exception/xts:exceptionDetail/bus:exception/bus:message">
- <message level="{*[local-name()='nestingLevel']}">
- <xsl:value-of select="*[local-name()='messageString']"/>
- </message>
- </xsl:for-each>
- </errors>
- </xsl:template>
- <xsl:template match="text()"/>
- </xsl:stylesheet>
- </xts:block>
-
- <!-- operation results -->
- <xts:block id="commandResults" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="doTest" nodelist="testResults,user">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xts xsl">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/root">
- <test:testDataSourceConnectionResponse xmlns:test="http://developer.cognos.com/schemas/xts/portal/iTestDataSource/1/">
- <xsl:for-each select="/root/testResults/dispatcher">
- <xsl:sort select="displayName" order="ascending" lang="{/root/user/contentLocale}"/>
- <xsl:copy>
- <xsl:copy-of select="@*|connectionString|displayName|displayPath|displayIcon|displayScreenTip|connectionType|connectionStack|ancestors"/>
- <xsl:choose>
- <xsl:when test="errors">
- <status>failed</status>
- <displayStatus><xts:string id="IDS_JOB_STATUS_FAILED"/></displayStatus>
- <xsl:copy-of select="errors"/>
- </xsl:when>
- <xsl:otherwise>
- <status>succeeded</status>
- <displayStatus><xts:string id="IDS_JOB_STATUS_SUCCEEDED"/></displayStatus>
- <xsl:copy-of select="*[local-name() = 'response']/*"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:copy>
- </xsl:for-each>
- </test:testDataSourceConnectionResponse>
- </xsl:template>
- <xsl:template match="text()"/>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|