Hi,

I'm Trying to remove duplicates from a data service result[1] using
XSLT[2]. This XSLT works when used with an online tool however it doesn't
work when this is applied in DSS [3] . Any idea on what's wrong here?.


[1] <CustomersCollection xmlns="http://ws.wso2.org/dataservice";>
   <Customers>
      <Customer>
         <CustomerName>Tom B. Erichsen</CustomerName>
         <Address>111 Metropoliton avaenue</Address>
         <City>Charlotte</City>
         <PostalCode>4006</PostalCode>
         <Country>US</Country>
      </Customer>
      <Customer>
         <CustomerName>Tom B. Erichsen</CustomerName>
         <Address>111 Metropoliton avaenue</Address>
         <City>Charlotte</City>
         <PostalCode>4006</PostalCode>
         <Country>US</Country>
      </Customer>
   </Customers>
</CustomersCollection>


[2] <xsl:stylesheet version="2.0"  xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
 <xsl:output  method="xml" omit-xml-declaration="yes" indent="yes"/>
 <xsl:template match="/*">
     <CustomersCollection xmlns="http://ws.wso2.org/dataservice/avid";>
         <xsl:for-each-group select="//*:Customers/*:Customer"
group-by="//*:City">
         <xsl:sequence select="."/>
       </xsl:for-each-group>
     </CustomersCollection>
 </xsl:template>
</xsl:stylesheet>

[3] <data name="SimpleAvidFederation_2" serviceNamespace="
http://ws.wso2.org/dataservice/avid";>
   <config id="mysql_ds">
      <property
name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property>
      <property
name="org.wso2.ws.dataservice.protocol">jdbc:mysql://localhost:3306/aviddb_1</property>
      <property name="org.wso2.ws.dataservice.user">root</property>
      <property name="org.wso2.ws.dataservice.password">root</property>
   </config>
   <config id="default">
      <property name="carbon_datasource_name">avid_postgres_2</property>
   </config>
   <operation name="find_customer_purchases">
      <call-query href="federate_find_query">
         <with-param name="CustomerId" query-param="CustomerId"/>
      </call-query>
   </operation>
   <query id="federate_find_query" useConfig="default">
      <sql>SELECT CustomerName, Address, City, PostalCode, Country FROM
Customers WHERE CustomerId = ? </sql>
      <param name="CustomerId" ordinal="1" paramType="SCALAR"
sqlType="STRING" type="IN"/>
      <result defaultNamespace="http://ws.wso2.org/dataservice/avid";
element="CustomersCollection" rowName="Customers"
xsltPath="./samples/xslt/transform_2.xslt">
         <call-query href="select_customer_by_id_1">
            <with-param name="CustomerId" query-param="CustomerId"/>
         </call-query>
         <call-query href="select_customer_by_id_2">
            <with-param name="CustomerId" query-param="CustomerId"/>
         </call-query>
      </result>
   </query>
   <query id="select_customer_by_id_1" useConfig="default">
      <sql>SELECT CustomerName, Address, City, PostalCode, Country FROM
Customers WHERE CustomerId = ? </sql>
      <param name="CustomerId" ordinal="1" paramType="SCALAR"
sqlType="STRING" type="IN"/>
      <result rowName="Customer">
         <element column="CustomerName" name="CustomerName"
xsdType="xs:string"/>
         <element column="Address" name="Address" xsdType="xs:string"/>
         <element column="City" name="City" xsdType="xs:string"/>
         <element column="PostalCode" name="PostalCode"
xsdType="xs:string"/>
         <element column="Country" name="Country" xsdType="xs:string"/>
      </result>
   </query>
   <query id="select_customer_by_id_2" useConfig="mysql_ds">
      <sql>SELECT CustomerName, Address, City, PostalCode, Country FROM
Customers WHERE CustomerId = ? </sql>
      <param name="CustomerId" ordinal="1" paramType="SCALAR"
sqlType="STRING" type="IN"/>
      <result rowName="Customer">
         <element column="CustomerName" name="CustomerName"
xsdType="xs:string"/>
         <element column="Address" name="Address" xsdType="xs:string"/>
         <element column="City" name="City" xsdType="xs:string"/>
         <element column="PostalCode" name="PostalCode"
xsdType="xs:string"/>
         <element column="Country" name="Country" xsdType="xs:string"/>
      </result>
   </query>
   <resource method="GET" path="Purchases/{CustomerId}">
      <call-query href="federate_find_query">
         <with-param name="CustomerId" query-param="CustomerId"/>
      </call-query>
   </resource>
</data>

Regards,
-- 
*Anuruddha Premalal*
Software Eng. | WSO2 Inc.
Mobile : +94710461070
Web site : www.regilandvalley.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to