• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Generating xsl to convert Xml into text format using transformation engine.

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi to all !!!
I'm facing problem in generating xsl for a specific type of xml and to convert it into text file.
can anybody suggest or send me a code snippet to have this completed..
I would be very thankful for the same...
thanks
akshay
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Akshay, you'll need to be a bit more specific for anyone to be able to help you.
 
akshay pandit
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lasse,
Thanks for replying
Basically my problem is , i have an xml format through which i need to generate a text file using an Xsl. I also have fixed text format now i need xsl which can convert that xml into required text format using transformation engine.
Xml Format:-
-----------
<Template description="Vehsim" name="Vehsim" id="1" >
<Variable type="Tabular" description="MX_TOTAL_TABLE" name="MX_TOTAL_TABLE" id="5" maxSeriesSize="50" >
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="NULL" updatecount="1" description="Low Speed Threshhold for steering compliance to prevent numerical
instablily" source="" mappingtype="CDMField" name="*VLOW_STR_COMP(1)" semantics="SEMANTICS" id="12" maxSeriesSize="0" >
<Data id="1">987</Data>
</Variable>
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="NULL" updatecount="1" description="Low Speed Threshhold for steering compliance to prevent numerical
instablily" source="" mappingtype="CDMField" name="*VLOW_STR_COMP(1)" semantics="SEMANTICS" id="12" maxSeriesSize="0" >
<Data id="1">123</Data>
</Variable>
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="NULL" updatecount="1" description="lookup table characterizing Front Steer Compliance" source="" mappingtype="CDMField" name="STEER_COMP_TABLE(1)" semantics="SEMANTICS" id="10" maxSeriesSize="0" >
<Data id="1">478</Data></Variable>
</Variable>
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="NULL" updatecount="1" description="Low Speed Threshhold for steering compliance to prevent numerical
instablily" source="" mappingtype="CDMField" name="*VLOW_STR_COMP(1)" semantics="SEMANTICS" id="12" maxSeriesSize="0" >
<Data id="1">987</Data></Variable>
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="NULL" updatecount="1" description="lookup table characterizing Front Steer Compliance" source="" mappingtype="CDMField" name="STEER_COMP_TABLE(1)" semantics="SEMANTICS" id="10" maxSeriesSize="0" >
<Data id="1">478</Data></Variable>
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="NULL" updatecount="1" description="lookup table characterizing Rear Steer Compliance" source="" mappingtype="CDMField" name="STEER_COMP_TABLE(2)" semantics="SEMANTICS" id="11" maxSeriesSize="0" >
<Data id="1">200</Data></Variable>
<Variable type="Tabular" description="STEER_COMP_TABLE" name="STEER_COMP_TABLE" id="2" maxSeriesSize="50" >
<Variable type="Complex" comments="dfgdfgh" sourceName="Y" modifiedTime="" argumentName="NULL" updatecount="1" description="Y Coordinate of Steer Comp table" source="" mappingtype="Compliance Fit" name="Y" semantics="com.gm.transform.ComplianceSheet" id="2" maxSeriesSize="0" >
<Data id="2">54</Data>
</Variable>
<Variable type="Complex" comments="" sourceName="VALUE" modifiedTime="" argumentName="STEERCOMP_X" updatecount="0" description="Steer Comp" source="" mappingtype="Fill" name="SteerComp_X" semantics="com.gm.transform.Fill" id="4" maxSeriesSize="0" >
<Data id="2">155</Data>
</Variable>
<Variable type="Simple" comments="" sourceName="CDM" modifiedTime="" argumentName="COEFFICIENT_B" updatecount="0" description="Aligning Torque Steer Model B Coefficient" source="" mappingtype="CDMField" name="CoefficientB" semantics="SEMANTICS" id="5" maxSeriesSize="0" >
<Data id="4">144</Data>
<Data id="3">122</Data>
</Variable>
</Variable>
</Template>
Now i need to read the values(only name) inside node Variable and the Data in data node.
and display in the fashion mentioned below:
Name of the variable Value
For ex: *VLOW_STR_COMP(1) 987
SteerComp_X 155
this data is shown as an demo of text file which comes from above Xml file.
Now i need Xsl which can do this.
Thanks in advance
Waiting for your quick reply.
thanks again
akshay
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could start with this:
[ October 31, 2003: Message edited by: Lasse Koskela ]
 
akshay pandit
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lasse,
Thanks for the solution.
It would be a great help if u provide one more solution.
I have generated required text file using your code and the code i have.
The problem now i am facing is to display result in proper format.
For ex:
Suppose the format for XML is :
<Variable type="Tabular" name="STEER_COMP_TABLE">
<Variable type="Simple" name="X">
<Data id="1">999</Data>
<Data id="2">888</Data>
<Data id="3">777</Data>
<Data id="4">666</Data>
</Variable>
<Variable type="Simple" name="Y">
<Data id="1">111</Data>
<Data id="2">222</Data>
<Data id="3">333</Data>
<Data id="4">444</Data>
</Variable>
</Variable>

Now if i have two Simple variables X & Y inside Tabular variable
whose data i have to write in text file in the fashion mentioned below:
STEER_COMP_TABLE
999 111
888 222
777 333
666 444
i.e first i have to read the name from variable type "Tabular"
and then data from variable type "Simple" one by one as mentioned above.
i need to print both X & Y variables at same level one by one.
hope i made my problem clear to u.
waiting for ur quick reply as it is really urgent.
Thanks in advance
Akshay
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about
 
akshay pandit
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lasse for all your support.
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic