123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?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).
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:template match="menus">
- <script type="text/javascript">
- <xsl:for-each select="menu">
- <xsl:call-template name="gen-menu"/>
- </xsl:for-each>
- </script>
- </xsl:template>
- <xsl:template match="menu">
- <script type="text/javascript">
- <xsl:call-template name="gen-menu"/>
- </script>
- </xsl:template>
- <xsl:template name="gen-menu">
- <xsl:variable name="id" select="@id"/>
- <xsl:text> var menu_</xsl:text>
- <xsl:value-of select="$id"/>
- <xsl:text>=new ui_menu({id: "</xsl:text>
- <xsl:value-of select="$id"/>
- <xsl:text>", items:[ </xsl:text>
- <xsl:for-each select="menuitem">
- <xsl:if test="position() > 1">
- <xsl:text>, </xsl:text>
- </xsl:if>
- <xsl:text> {</xsl:text>
- <xsl:if test="@separatorBefore='true'">
- <xsl:text>separatorBefore: true, </xsl:text>
- </xsl:if>
- <xsl:for-each select="*[not(self::action)]">
- <xsl:value-of select="local-name()"/>
- <xsl:text>: "</xsl:text>
- <xsl:value-of select="."/>
- <xsl:text>", </xsl:text>
- </xsl:for-each>
- <xsl:text>action: </xsl:text>
- <xsl:choose>
- <xsl:when test="action">
- <xsl:text>function(evt) { </xsl:text>
- <xsl:value-of select="action"/>
- <xsl:text> }</xsl:text>
- </xsl:when>
- <xsl:otherwise>null</xsl:otherwise>
- </xsl:choose>
- <xsl:text> }</xsl:text>
- </xsl:for-each>
- <xsl:text> ] });</xsl:text>
- </xsl:template>
- </xsl:stylesheet>
|