123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2011
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/"
- xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
- version="1.0" exclude-result-prefixes="form cps">
-
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
-
- <!-- Create a namespace - neutral reference to form params -->
- <xsl:variable name="nnParam" select="form:env/form:param | env/param"/>
-
- <xsl:template match="form:env | env">
- <layout version="1.0">
-
- <!-- Layout properties -->
- <layoutProperties>
- <param name="flexibleColumnLayout">
- <xsl:call-template name="setBoolAttribute">
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_flexibleColWidth']"/>
- </xsl:call-template>
- </param>
- </layoutProperties>
- <!-- Title -->
- <title>
- <xsl:attribute name="hidden">
- <xsl:call-template name="setBoolAttribute">
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_hideTitle']"/>
- </xsl:call-template>
- </xsl:attribute>
- <!-- font -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'font'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleFont']"/>
- </xsl:call-template>
- <!-- size -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'size'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleFontSize']"/>
- </xsl:call-template>
- <!-- colour -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'colour'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleColour']"/>
- </xsl:call-template>
- <!-- bold -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'bold'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleBold']"/>
- </xsl:call-template>
- <!-- italic -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'italic'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleItalic']"/>
- </xsl:call-template>
- <!-- undeline -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'underline'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleUnderline']"/>
- </xsl:call-template>
- <!-- align -->
- <xsl:call-template name="setITitleStyleAttribute">
- <xsl:with-param name="name" select="'align'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_titleAlign']"/>
- </xsl:call-template>
- <xsl:for-each select="$nnParam[starts-with(@name, 'm_mp_title_')]">
- <value>
- <xsl:attribute name="xml:lang"><xsl:value-of select="substring-after(@name, 'm_mp_title_')"/></xsl:attribute>
- <xsl:value-of select="."/>
- </value>
- </xsl:for-each>
- <xsl:if test="$nnParam[starts-with(@name, 'm_mp_mlt_title_')]">
- <value>
- <xsl:attribute name="xml:lang"><xsl:value-of select="$nnParam[@name='m_mp_language']"/></xsl:attribute>
- <xsl:value-of select="$nnParam[starts-with(@name, 'm_mp_mlt_title_')]"/>
- </value>
- </xsl:if>
- </title>
-
- <!-- Instructions -->
- <instructions>
- <xsl:attribute name="hidden">
- <xsl:call-template name="setBoolAttribute">
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_hideInstructions']"/>
- </xsl:call-template>
- </xsl:attribute>
- <!-- font -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'font'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsFont']"/>
- </xsl:call-template>
- <!-- size -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'size'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsFontSize']"/>
- </xsl:call-template>
- <!-- colour -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'colour'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsColour']"/>
- </xsl:call-template>
- <!-- bold -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'bold'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsBold']"/>
- </xsl:call-template>
- <!-- italic -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'italic'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsItalic']"/>
- </xsl:call-template>
- <!-- undeline -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'underline'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsUnderline']"/>
- </xsl:call-template>
- <!-- align -->
- <xsl:call-template name="setInstructionsStyleAttribute">
- <xsl:with-param name="name" select="'align'"/>
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_instructionsAlign']"/>
- </xsl:call-template>
- <xsl:for-each select="$nnParam[starts-with(@name, 'm_mp_instructions_')]">
- <value>
- <xsl:attribute name="xml:lang"><xsl:value-of select="substring-after(@name, 'm_mp_instructions_')"/></xsl:attribute>
- <xsl:value-of select="."/>
- </value>
- </xsl:for-each>
- <xsl:if test="$nnParam[starts-with(@name, 'm_mp_mlt_instructions_')]">
- <value>
- <xsl:attribute name="xml:lang"><xsl:value-of select="$nnParam[@name='m_mp_language']"/></xsl:attribute>
- <xsl:value-of select="$nnParam[starts-with(@name, 'm_mp_mlt_instructions_')]"/>
- </value>
- </xsl:if>
- </instructions>
-
- <!-- Portlet Options -->
- <portletOptions>
- <xsl:attribute name="hideBorders">
- <xsl:call-template name="setBoolAttribute">
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_hideBorders']"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="hideTitleBars">
- <xsl:call-template name="setBoolAttribute">
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_hideTitleBars']"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="hideEditMode">
- <xsl:call-template name="setBoolAttribute">
- <xsl:with-param name="value" select="$nnParam[@name = 'm_mp_hideEditMode']"/>
- </xsl:call-template>
- </xsl:attribute>
- </portletOptions>
-
- <!-- Column layout -->
- <xsl:choose>
- <!-- 1.1 page layout -->
- <xsl:when test="$nnParam[@name = 'pagexml']">
- <xsl:apply-templates select="$nnParam[@name = 'pagexml']/*/cps:layout/*[local-name() = 'layout']/*[local-name() != 'title' and local-name() != 'instructions' and local-name() != 'portletOptions']"/>
- </xsl:when>
- <!-- 1.0 page layout -->
- <xsl:when test="$nnParam[@name = 'm_mp_columns']">
- <xsl:choose>
- <xsl:when test="$nnParam[@name = 'm_mp_columns'] = '2'">
- <column>
- <xsl:attribute name="width">
- <xsl:value-of select="$nnParam[@name = 'm_mp_firstColumnWidth']"/>
- </xsl:attribute>
- <xsl:for-each select="$nnParam[@name = 'm_mp_col1sort']">
- <portlet id="{substring-after(.,',')}"/>
- </xsl:for-each>
- </column>
- <column>
- <xsl:attribute name="width">
- <xsl:value-of select="$nnParam[@name = 'm_mp_secondColumnWidth']"/>
- </xsl:attribute>
- <xsl:for-each select="$nnParam[@name = 'm_mp_col2sort']">
- <portlet id="{substring-after(.,',')}"/>
- </xsl:for-each>
- </column>
- </xsl:when>
- <xsl:when test="$nnParam[@name = 'm_mp_columns'] = '3'">
- <column>
- <xsl:attribute name="width">
- <xsl:value-of select="$nnParam[@name = 'm_mp_firstColumnWidth']"/>
- </xsl:attribute>
- <xsl:for-each select="$nnParam[@name = 'm_mp_col1sort']">
- <portlet id="{substring-after(.,',')}"/>
- </xsl:for-each>
- </column>
- <column>
- <xsl:attribute name="width">
- <xsl:value-of select="$nnParam[@name = 'm_mp_secondColumnWidth']"/>
- </xsl:attribute>
- <xsl:for-each select="$nnParam[@name = 'm_mp_col2sort']">
- <portlet id="{substring-after(.,',')}"/>
- </xsl:for-each>
- </column>
- <column>
- <xsl:attribute name="width">
- <xsl:value-of select="$nnParam[@name = 'm_mp_thirdColumnWidth']"/>
- </xsl:attribute>
- <xsl:for-each select="$nnParam[@name = 'm_mp_col3sort']">
- <portlet id="{substring-after(.,',')}"/>
- </xsl:for-each>
- </column>
- </xsl:when>
- <xsl:otherwise>
- <column>
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="$nnParam[@name = 'm_mp_firstColumnWidth']">
- <xsl:value-of select="$nnParam[@name = 'm_mp_firstColumnWidth']"/>
- </xsl:when>
- <xsl:otherwise>100</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:for-each select="$nnParam[@name = 'm_mp_col1sort']">
- <portlet id="{substring-after(.,',')}"/>
- </xsl:for-each>
- </column>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
-
- <!-- Gen default col layout -->
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$nnParam[@name = 'pagexml']">
- <row>
- <column width="100"/>
- </row>
- </xsl:when>
- <xsl:otherwise>
- <column width="100"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
-
-
- </layout>
- </xsl:template>
-
- <xsl:template name="setBoolAttribute">
- <xsl:param name="value"/>
- <xsl:choose>
- <xsl:when test="$value = 'true'">true</xsl:when>
- <xsl:otherwise>false</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="setStyleAttribute">
- <xsl:param name="value"/>
- <xsl:choose>
- <xsl:when test="$value != ''"><xsl:value-of select="$value"/></xsl:when>
- <xsl:otherwise>default</xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="setInstructionsStyleAttribute">
- <xsl:param name="name"/>
- <xsl:param name="value"/>
- <xsl:if test="$value != '' and $nnParam[@name = 'm_mp_instructionsStyle'] = 'custom'">
- <xsl:attribute name="{$name}">
- <xsl:value-of select="$value"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:template>
-
- <xsl:template name="setITitleStyleAttribute">
- <xsl:param name="name"/>
- <xsl:param name="value"/>
- <xsl:if test="$value != '' and $nnParam[@name = 'm_mp_titleStyle'] = 'custom'">
- <xsl:attribute name="{$name}">
- <xsl:value-of select="$value"/>
- </xsl:attribute>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="*">
- <xsl:element name="{local-name()}">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:element>
- </xsl:template>
- </xsl:stylesheet>
|