123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2015
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xsl:stylesheet version="1.0" xmlns:out="dummy-uri"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xsl lyt xtsext xts cm">
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <!--
- This stylesheet (layout.xsl) consists of the following templates:
- lyt:layout - render a particular layout for a portion of the CC web page.
- -->
- <!--
- Template - lyt:layout:
- This template is used to render a specific layout on a CC Web page.
- A layout can have a title and border at the top of the layout.
- A layout can be joined to a previously rendered layout.
- A layout must contain at least one lyt:section.
- Operation:
- Renders a layout based on the specified attributes:
- @joinSection - specifies not to produce padding between layouts.
- @title - specified to render a title, value is an XTS string ID
- @longTitle = specified to render a title, value is a string
- @border - specifies to render a separating border
- @intro - specifies that there is informational text to be presented
- @style - 1) A single section 2) Two parallel sections
- @width - specifies the width of the layout.
- lyt:section
- @width - specifies the width of the section.
- @height - specifies the height of the section.
- NOTE: CODE WILL NOT PASS BETWEEN THE FOLLOWING TAGS
- <lyt:layout> and <lyt:section>
- -->
- <xsl:template match="lyt:layout">
- <xsl:if test="not(@joinSection)">
- <table summary="" border="0" cellpadding="0" cellspacing="0" width="100%" role="presentation">
- <tr>
- <td height="10" width="100%">
- </td>
- </tr>
- </table>
- </xsl:if>
- <xsl:variable name="titleText">
- <xsl:choose>
- <xsl:when test="@longTitle and @longTitle!=''">
- <out:value-of select="{@longTitle}"/> 
- </xsl:when>
- <xsl:when test="@title and @title!=''">
- <xts:string id="{@title}"/> 
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="@title or @longTitle or @border='yes'">
- <table summary="" width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
- <xsl:if test="@tabindex">
- <xsl:attribute name="tabindex"><xsl:value-of select="@tabindex"/></xsl:attribute>
- </xsl:if>
- <tr>
- <td width="8">
- </td>
- <xsl:if test="@title or @longTitle">
- <td valign="middle" nowrap="nowrap" class="formLabel">
- <xsl:if test="@id">
- <xsl:attribute name="id">
- <xsl:value-of select="@id"/>
- </xsl:attribute>
- </xsl:if>
- <xsl:copy-of select="$titleText"/>
- </td>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="@border = 'yes'">
- <td width="100%" valign="middle" align="right">
- <table summary="" width="100%" height="1" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td class="dialogDivider">
- </td>
- </tr>
- </table>
- </td>
- </xsl:when>
- <xsl:otherwise><td width="100%" valign="middle" align="right"/></xsl:otherwise>
- </xsl:choose>
- <td width="10">
- </td>
- </tr>
- </table>
- <table summary="" width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td height="5" width="1">
- </td>
- </tr>
- </table>
- </xsl:if>
- <xsl:if test="@intro">
- <table summary="" role="presentation" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-bottom:10px;">
- <tr>
- <td height="1" width="8"><img height="1" width="8" src="{'{$webcontent}'}/images/space.gif" alt=""/></td>
- <td width="100%" valign="top" class="dialogHintText"><xts:string id="{@intro}"/></td>
- <td height="5" width="1"><img height="5" width="1" src="{'{$webcontent}'}/images/space.gif" alt=""/></td>
- </tr>
- </table>
- </xsl:if>
- <xsl:if test="lyt:intro">
- <table summary="" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-bottom:10px;" role="presentation">
- <tr>
- <td height="1" width="8">
- <img height="1" width="8" src="{'{$webcontent}'}/images/space.gif" alt=""/>
- </td>
- <td width="100%" valign="top" align="left" class="dialogHintText">
- <xsl:apply-templates select="lyt:intro/child::node()"/>
- </td>
- <td height="5" width="1">
- <img height="5" width="1" src="{'{$webcontent}'}/images/space.gif" alt=""/>
- </td>
- </tr>
- </table>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="@style='1'">
- <table summary="" border="0" cellspacing="0" cellpadding="3" role="presentation">
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
- <xsl:otherwise>100%</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:variable name="varSuffix" select="generate-id()"/>
- <!-- if there is a section title then use that otherwise you the title of the layout -->
- <out:variable name="titleText{$varSuffix}">
- <xsl:copy-of select="$titleText"/>
- </out:variable>
- <xsl:for-each select="lyt:section">
- <tr>
- <td height="1" width="1">
- </td>
- <td>
- <xsl:copy-of select="@*[local-name() != 'width' and local-name() != 'title']"/>
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
- <xsl:otherwise>100%</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
- <xsl:if test="@noTitle != 'true'">
- <out:if test="$titleText{$varSuffix} != ''">
- <out:attribute name="role">group</out:attribute>
- <out:attribute name="aria-label">
- <out:variable name="secTitle"><xts:string id="{@title}"/></out:variable>
- <out:choose>
- <out:when test="$secTitle != ''"><out:value-of select="$secTitle"/></out:when>
- <out:otherwise><out:value-of select="$titleText{$varSuffix}"/></out:otherwise>
- </out:choose>
- </out:attribute>
- </out:if>
- </xsl:if>
- <xsl:apply-templates select="*"/>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:when>
- <xsl:when test="@style='2'">
- <table summary="" border="0" cellspacing="0" cellpadding="3" role="presentation">
- <xsl:if test="@width">
- <xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
- </xsl:if>
- <xsl:variable name="varSuffix" select="generate-id()"/>
- <out:variable name="titleText{$varSuffix}">
- <xsl:copy-of select="$titleText"/>
- </out:variable>
- <xsl:for-each select="lyt:section[(position() mod 2) = 1]">
- <tr>
- <out:if test="$titleText{$varSuffix} != ''">
- <out:attribute name="role">group</out:attribute>
- <out:attribute name="aria-label"><out:value-of select="$titleText{$varSuffix}"/></out:attribute>
- </out:if>
- <td height="1" width="1">
- </td>
- <td valign="top">
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="@width"><xsl:value-of select="@width"/></xsl:when>
- <xsl:otherwise>50%</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:apply-templates select="*"/>
- </td>
- <td valign="top">
- <xsl:attribute name="width">
- <xsl:choose>
- <xsl:when test="@width"><xsl:value-of select="following-sibling::*[1]/@width"/></xsl:when>
- <xsl:otherwise>50%</xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:apply-templates select="following-sibling::*[1]/*"/>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|