By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

Extracting Data from XML using XSL

gpraghuram
Expert 100+
P: 1,275
Hi,
I want to know how to extract information from a XML file using a XSL style sheet using perl.
I have alreday written a XSL for a XML file.
My requirement is to apply this XSL on the xml which in turn gives me a csv output.
Which module shuld i use for this?
Thanks
Raghu
Nov 10 '09 #1
Share this Question
Share on Google+
5 Replies


Frinavale
Expert Mod 5K+
P: 9,731
I'm not very familiar with many Perl modules but the logic behind this doesn't seem that hard.

CSV files are just files containing comma-separated values.
You could use the XSL to transform the XML into comma-separated values and then just output this to a csv file.

Upon doing a quick google search on the topic turned up a lot of examples...most of them weren't using Perl but since this is mostly about using XML (and XSL) to produce comma-separated values....it seems like it shouldn't be too hard to apply this to Perl.

Googling also revealed that you're going to need to use the XML::XSLT and XML::DOM modules.



-Frinny
Nov 13 '09 #2

numberwhun
Expert Mod 2.5K+
P: 3,503
And if you want to get really freaky with your CSV file creation, you can use the DBD::CSV module, which allows you to treat a csv file as a database.

Also, simply search on the CPAN site for CSV and you will find other modules for reading/writing CSV files.

Regards,

Jeff
Nov 17 '09 #3

Frinavale
Expert Mod 5K+
P: 9,731
That module sounds awesome numberwun!

:)

Hope it helps the OP
Nov 17 '09 #4

gpraghuram
Expert 100+
P: 1,275
Hi,

Thanks for the suggestion.
I was able to use XML::XSLT to achive this.

Thanks
Raghu
Nov 25 '09 #5

numberwhun
Expert Mod 2.5K+
P: 3,503
Glad that it worked for you Raghu.
Nov 25 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.