12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cogadmin
- (C) Copyright IBM Corp. 2005, 2010
- 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"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd"
- xmlns:resource-prop="http://developer.cognos.com/admin/properties"
- xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2"
- xmlns:nemo="http://developer.cognos.com/nemo"
- exclude-result-prefixes="wsrf-rp nemo xsl SOAP-ENV muws2">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
- <xsl:key name="properties" match="/root/input[@name='dataResponse']/wsrf-rp:GetMultipleResourcePropertiesResponse/*" use="local-name()"/>
- <xsl:key name="property-metadata-by-group" match="/root/input[@name='metadataResponse']/wsrf-rp:GetMultipleResourcePropertiesResponse/nemo:MetadataDescriptor/nemo:Property" use="nemo:MetricGroup"/>
- <xsl:template match="/root">
- <response>
- <metadataAndDataResponse>
- <nemo:Resource>
- <xsl:variable name="mdd" select="/root/input[@name='metadataResponse']/wsrf-rp:GetMultipleResourcePropertiesResponse/nemo:MetadataDescriptor"/>
-
- <!-- Properties in a group -->
- <xsl:variable name="allGroups" select="$mdd/nemo:PropertiesGroups/nemo:PropertiesGroup"/>
- <xsl:for-each select="$allGroups">
- <xsl:variable name="group" select="."/>
- <xsl:variable name="groupID" select="nemo:URI"/>
- <xsl:variable name="propertiesInThatGroup" select="key('property-metadata-by-group', string($groupID))"/>
-
- <xsl:for-each select="$propertiesInThatGroup">
- <xsl:if test="position() = 1">
- <xsl:text disable-output-escaping="yes"><nemo:PropertiesGroup></xsl:text>
- <xsl:copy-of select="$group/nemo:URI"/>
- <xsl:copy-of select="$group/nemo:Caption"/>
- <xsl:copy-of select="$group/nemo:Description"/>
- <!-- Metric group actions -->
- <xsl:copy-of select="$mdd/nemo:Action[starts-with(nemo:Capability, 'http://cognos.com/admin/supportedactions/metricgroup')]"/>
- </xsl:if>
-
- <xsl:call-template name="insertProperty">
- <xsl:with-param name="metadata" select="."/>
- <xsl:with-param name="value" select="key('properties', ./nemo:Name)"/>
- </xsl:call-template>
-
- <xsl:if test="position() = last()">
- <xsl:text disable-output-escaping="yes"></nemo:PropertiesGroup></xsl:text>
- </xsl:if>
- </xsl:for-each>
-
- </xsl:for-each>
-
- <!-- Properties not in a group -->
- <xsl:variable name="propertiesWithoutAGroup" select="$mdd/nemo:Property[not(nemo:MetricGroup)]"/>
- <xsl:for-each select="$propertiesWithoutAGroup">
- <xsl:call-template name="insertProperty">
- <xsl:with-param name="metadata" select="."/>
- <xsl:with-param name="value" select="key('properties', ./nemo:Name)"/>
- </xsl:call-template>
- </xsl:for-each>
-
- <!-- Resource actions -->
- <xsl:copy-of select="$mdd/nemo:Action[starts-with(nemo:Capability, 'http://cognos.com/admin/supportedactions/resource')]"/>
-
- </nemo:Resource>
- </metadataAndDataResponse>
- </response>
- </xsl:template>
-
- <xsl:template name="insertProperty">
- <xsl:param name="metadata" select="''"/>
- <xsl:param name="value" select="''"/>
- <nemo:Property>
- <xsl:copy-of select="$metadata/*"/>
- <nemo:Value/>
- </nemo:Property>
- </xsl:template>
- </xsl:stylesheet>
|