123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: AGS
- (C) Copyright IBM Corp. 2005, 2008
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xsl:stylesheet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/dialog/" xmlns:out="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xts xsl agsdlg out pf bus xtsext xsi cm">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <pf:variables/>
- <agsdlg:parameterText quote-string="/root/displayedPage/@quote-string"/>
- <agsdlg:parameterTextUnTrimmed quote-string="/root/displayedPage/@quote-string"/>
- <xsl:template match="/">
- <xts:sequence>
- <!--when the type is sql....the value selected is entered by the user setting up the sql argument in Framework manager
- if none is provided, we cannot call the sp properly, if they are not unique ditto. the parameter value name passed around is the value-->
- <xts:append select="/root">
- <parametersDisplay>
- <objectClass><xsl:value-of select="/root/env/param[@name='objectClass']"/></objectClass>
- <!--xsl:apply-templates select="/root/parametersResponse/parameter/item"/-->
- <!--This can be used for unique nodes:-->
- <xsl:apply-templates select="/root/parametersResponse/parameter/item[not(./name=preceding-sibling::item/name)]"/>
- </parametersDisplay>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- <xsl:template match="item">
-
- <xsl:variable name="value" select="substring-before(substring-after(./value, '?'),'?')"/>
- <xsl:variable name="name">
- <xsl:choose>
- <xsl:when test="/root/displayedPage = 'sql' and not($value = '')">
- <xsl:value-of select="substring-before(substring-after(./value, '?'),'?')"/>
- </xsl:when>
- <xsl:when test="../simplejavatype='false' and not(../name='parameters')">
- <xsl:value-of select="concat(../name,'/',./name)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="./name"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="disabled">
- <xsl:choose>
- <xsl:when test="/root/displayedPage = 'sql' and $value = ''">
- <xsl:value-of select="'true'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'false'"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="./name='parameters'">
- <!-- doc literals param parent has name as parameters so we dont wrap it with parameter tag-->
- <xsl:if test="./simplejavatype='false'">
- <!-- complex data found -->
- <xsl:apply-templates select="./item"/>
- </xsl:if>
- </xsl:when>
- <xsl:otherwise>
- <parameter>
- <xsl:variable name="paramName" select="./name"/>
- <xsl:attribute name="name"><xsl:value-of select="./name"/></xsl:attribute>
- <xsl:attribute name="sqlCredentialValue"><xsl:value-of select="/root/credentialParameters/credentialParameter[@name=$paramName]/dataSource//*[local-name()='dataSourceConnection']/*[local-name()='defaultName']"/></xsl:attribute>
- <xsl:attribute name="caption"><xsl:choose><xsl:when test="./type='credential'"><xsl:if test="/root/credentialParameters/credentialParameter[@name=$paramName]/dataSource//*[local-name()='dataSourceConnection']/*[local-name()='defaultName']"><xsl:value-of select="/root/credentialParameters/credentialParameter[@name=$paramName]/dataSource//*[local-name()='dataSourceConnection']/*[local-name()='defaultName']"/></xsl:if></xsl:when><xsl:when test="./caption/item[./locale = $contentLocale]"><xsl:value-of select="./caption/item[./locale = $contentLocale]/value"/></xsl:when><xsl:otherwise><xsl:value-of select="$name"/></xsl:otherwise></xsl:choose></xsl:attribute>
- <xsl:attribute name="multivalued"><xsl:choose><xsl:when test="contains(./capabilities, 'multivalued')"><xsl:text>true</xsl:text></xsl:when><xsl:otherwise><xsl:text>false</xsl:text></xsl:otherwise></xsl:choose></xsl:attribute>
- <xsl:attribute name="required"><xsl:choose><xsl:when test="contains(./capabilities, 'optional')"><xsl:text>false</xsl:text></xsl:when><xsl:otherwise><xsl:text>true</xsl:text></xsl:otherwise></xsl:choose></xsl:attribute>
- <xsl:attribute name="disabled"><xsl:value-of select="$disabled"/></xsl:attribute>
- <xsl:attribute name="type"><xsl:call-template name="convertTypeName"><xsl:with-param name="type"><xsl:value-of select="./type"/></xsl:with-param></xsl:call-template></xsl:attribute>
- <xsl:attribute name="format"><xsl:call-template name="createFormat"/></xsl:attribute>
- <xsl:attribute name="value"><xsl:value-of select="./value"/></xsl:attribute>
- <xsl:attribute name="simplejavatype"><xsl:value-of select="./simplejavatype"/></xsl:attribute>
- <xsl:if test="/root/agent_item/parameterData/parameterAssignments/parameterAssignment[./parameterName = $name]">
- <xsl:attribute name="modelValue"><xsl:value-of select="/root/agent_item/parameterData/parameterAssignments/parameterAssignment[./parameterName = $name]/dataItemName"/></xsl:attribute>
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="/root/displayedPage = 'report' and /root/agent_item/parameterData/parameterValues/item[./name = $name]">
- <xsl:attribute name="literalValue"><xsl:call-template name="parameterText"><xsl:with-param name="parameter"><xsl:copy-of select="/root/agent_item/parameterData/parameterValues/item[./name = $name]"/></xsl:with-param><xsl:with-param name="parameterTextSize"><xsl:text>75</xsl:text></xsl:with-param></xsl:call-template></xsl:attribute>
- </xsl:when>
-
- <xsl:when test="/root/displayedPage != 'report' and /root/agent_item/parameterData/parameterValues/item[./name = $name]">
- <xsl:attribute name="literalValue"><xsl:call-template name="parameterTextUnTrimmed"><xsl:with-param name="parameter"><xsl:copy-of select="/root/agent_item/parameterData/parameterValues/item[./name = $name]"/></xsl:with-param></xsl:call-template></xsl:attribute>
-
- </xsl:when>
- <xsl:when test="/root/displayedPage = 'sql' and $value = ''">
- <xsl:attribute name="literalValue"><!-- we have a non variable literal parameter for a sp--><xsl:value-of select="./value"/></xsl:attribute>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="./simplejavatype='false'">
- <!-- complex data found -->
- <xsl:apply-templates select="./item"/>
- </xsl:if>
-
- </parameter>
-
- </xsl:otherwise>
- </xsl:choose>
-
-
- </xsl:template>
- <xsl:template name="createFormat">
- <xsl:if test="./size != ''">
- <xts:string id="DIALOG_SQL_SP_FORMAT_SIZE"/>
- <xsl:text>= </xsl:text>
- <xsl:value-of select="./size"/>
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:if test="./precision != ''">
- <xts:string id="DIALOG_SQL_SP_FORMAT_PREC"/>
- <xsl:text>= </xsl:text>
- <xsl:value-of select="./precision"/>
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:if test="./scale != ''">
- <xts:string id="DIALOG_SQL_SP_FORMAT_SCALE"/>
- <xsl:text>= </xsl:text>
- <xsl:value-of select="./scale"/>
- </xsl:if>
- </xsl:template>
- <!--template to get the name for the parameter data type-->
- <xsl:template name="convertTypeName">
- <xsl:param name="type"/>
- <xsl:variable name="displayedPage" select="/root/displayedPage"/>
- <xsl:choose>
- <xsl:when test="$displayedPage = 'web' or $displayedPage = 'sql' or $type=''">
- <xsl:value-of select="$type"/>
- </xsl:when>
- <xsl:when test="$type = 'xsdString' or $type= 'memberUniqueName' ">
- <xsl:text>
- <xts:string id="DIALOG_PROMPT_TEXT"/>
- </xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'xsdShort' or $type = 'xsdLong' or $type = 'xsdUnsignedByte' or $type = 'xsdUnsignedInt' or $type = 'xsdUnsignedLong' or $type = 'xsdShort' or $type = 'xsdFloat' or $type = 'xsdInt' or $type = 'xsdByte' or $type = 'xsdDecimal' or $type = 'xsdDouble' or $type = 'xsdUnsignedShort'">
- <xsl:text>
- <xts:string id="DIALOG_PROMPT_NUMBER"/>
- </xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'xsdDate' or $type = 'xsdTime' or $type = 'xsdDateTime'">
- <xsl:text>
- <xts:string id="DIALOG_PROMPT_DATE"/>
- </xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'xsdDuration'">
- <xsl:text>
- <xts:string id="DIALOG_PROMPT_DURATION"/>
- </xsl:text>
- </xsl:when>
- <xsl:when test="$type = 'credential'">
- <xsl:text>
- <xts:string id="DIALOG_PROMPT_CONNECTION"/>
- </xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>
- <xts:string id="DIALOG_PROMPT_TEXT"/>
- </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
|