Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 3rd, 2013, 07:56 AM
Registered User
 
Join Date: Jun 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSLT Transformation issue

Hi,

I need to transform below input XML to output XML. Can you please provide any ideas for this


Input XML :

<?xml version="1.0" encoding="UTF-8" ?>
<GenericCollection ParamValue="ParamValue1" xmlns="http://www.example.org">
<Generic>
<store>Store1</store>
<metricName>Metric1</metricName>
<metricValue>1</metricValue>
</Generic>
<Generic>
<store>Store1</store>
<metricName>Metric2</metricName>
<metricValue>1</metricValue>
</Generic>
<Generic>
<store>Store2</store>
<metricName>Metric1</metricName>
<metricValue>1</metricValue>
</Generic>
<Generic>
<store>Store2</store>
<metricName>Metric1</metricName>
<metricValue>2</metricValue>
</Generic>
<Generic>
<store>Store2</store>
<metricName>Metric2</metricName>
<metricValue>1</metricValue>
</Generic>
<Generic>
<store>Store3</store>
<metricName>Metric1</metricName>
<metricValue>1</metricValue>
</Generic>
<Generic>
<store>Store3</store>
<metricName>Metric1</metricName>
<metricValue>2</metricValue>
</Generic>
</GenericCollection>


Output XML :

<?xml version = '1.0' encoding = 'UTF-8'?>
<ns4:EnterpriseDocument>
<ns4:DataSet>
<ns4:Dimension ref_name="bu_code" value="Store1">
<ns4:Metric ref_name="Metric1">
<ns4:Data value="1"/>
</ns4:Metric>
<ns4:Metric ref_name="Metric2">
<ns4:Data value="1"/>
</ns4:Metric>
</ns4:Dimension>
<ns4:Dimension ref_name="bu_code" value="Store2">
<ns4:Metric ref_name="Metric1">
<ns4:Data value="1"/>
<ns4:Data value="2"/>
</ns4:Metric>
<ns4:Metric ref_name="Metric2">
<ns4:Data value="1"/>
</ns4:Metric>
</ns4:Dimension>
<ns4:Dimension ref_name="bu_code" value="Store3">
<ns4:Metric ref_name="Metric1">
<ns4:Data value="1"/>
<ns4:Data value="2"/>
</ns4:Metric>
</ns4:Dimension>
</ns4:DataSet>
</ns4:EnterpriseDocument>


Thanks,
Ramesh
 
Old June 9th, 2013, 10:11 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

You should use XSLT.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue with Tab Characters during XSLT Transformation tuananhpl1 XSLT 0 April 25th, 2013 02:35 AM
Issue with Tab Characters during XSLT Transformation sivakumar_g01 XSLT 1 October 20th, 2010 09:17 AM
Help on XSLT transformation li72 XSLT 2 February 22nd, 2008 12:33 PM
help with xslt transformation li72 XSLT 6 November 19th, 2007 01:51 PM
XSLT transformation causes ^M reddygaru XSLT 2 December 16th, 2003 10:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.