<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed Materials - Property of IBM

 IBM Cognos Products: fmmd

 (C) Copyright IBM Corp. 2003, 2010

 US Government Users Restricted Rights - Use, duplication or disclosure 
 restricted by GSA ADP Schedule Contract with IBM Corp.
-->
<xsl:stylesheet version="1.0" 
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
		xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
		xmlns:xs="http://www.w3.org/2001/XMLSchema" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xmlns:rns1="http://developer.cognos.com/schemas/contentManagerService/1"
		xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

  <xsl:template match="/">
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <xsl:apply-templates select="SOAP-ENV:Envelope/SOAP-ENV:Body/rns1:queryResponse/bus:result/item"/>
    </SOAP-ENV:Envelope>
  </xsl:template>

  <xsl:template match="bus:result/item">
    <queryResult>
      <item>
	<xsl:apply-templates select="bus:contentLocaleMap"/>
	<xsl:apply-templates select="bus:productLocaleMap"/>
	<xsl:apply-templates select="bus:supportedContentLocales"/>
	<xsl:apply-templates select="bus:supportedCurrencies"/>
      </item>
    </queryResult>
  </xsl:template>

  <xsl:template match="bus:contentLocaleMap">
    <contentLocaleMap>
      <value xsi:type="SOAP-ENC:Array">
	<xsl:attribute name="SOAP-ENC:arrayType">
	  <xsl:value-of select="bus:value/@SOAP-ENC:arrayType" />
	</xsl:attribute>

	<xsl:for-each select="bus:value/item">
	  <item>
	    <key xsi:type="xs:string">
	      <xsl:value-of select="bus:key"/>
	    </key>

	    <value xsi:type="xs:string">
	      <xsl:value-of select="bus:value"/>
	    </value>
	  </item>

	</xsl:for-each>
      </value>
    </contentLocaleMap>
  </xsl:template>

  <xsl:template match="bus:productLocaleMap">
    <productLocaleMap>
      <value xsi:type="SOAP-ENC:Array">
	<xsl:attribute name="SOAP-ENC:arrayType">
	  <xsl:value-of select="bus:value/@SOAP-ENC:arrayType" />
	</xsl:attribute>

	<xsl:for-each select="bus:value/item">
	  <item>
	    <key xsi:type="xs:string">
	      <xsl:value-of select="bus:key"/>
	    </key>

	    <value xsi:type="xs:string">
	      <xsl:value-of select="bus:value"/>
	    </value>
	  </item>

	</xsl:for-each>
      </value>
    </productLocaleMap>
  </xsl:template>

  <xsl:template match="bus:supportedCurrencies">
    <supportedCurrencies>
      <value xsi:type="SOAP-ENC:Array">
	<xsl:attribute name="SOAP-ENC:arrayType">
	  <xsl:value-of select="bus:value/@SOAP-ENC:arrayType" />
	</xsl:attribute>

	<xsl:for-each select="bus:value/item">
	  <item>
	    <xsl:value-of select="current()"/>
	  </item>

	</xsl:for-each>
      </value>
    </supportedCurrencies>
  </xsl:template>

  <xsl:template match="bus:supportedContentLocales">
    <supportedContentLocales xsi:type="bus:languageArrayProp">
      <value xsi:type="SOAP-ENC:Array">
	<xsl:attribute name="SOAP-ENC:arrayType">
	  <xsl:value-of select="bus:value/@SOAP-ENC:arrayType" />
	</xsl:attribute>
	<xsl:for-each select="bus:value/item">
	  <item xsi:type="xs:string"><xsl:value-of select="current()"/></item>
	</xsl:for-each>
      </value>
    </supportedContentLocales>
  </xsl:template>

</xsl:stylesheet>