Click to See Complete Forum and Search --> : How to convert XML file to tab-delimited text file


stringman
01-06-2006, 02:12 PM
I need to convert an XML file to a tab-delimited text file. I have been experimenting with XPath, DOM, and XSLT using PHP as the scripting language. I thought XSLT would be the way to go but everything I have seen is for creating an output file that is structured as an HTML document, but with a server-side scripting language extension (php, asp, etc).

In a nutshell, my project involves making a web app to allow users to browse for an application-generated XML file and convert it to a tab-delimited text file, which is then ingested into a database.

Can anyone tell me if I am using the right technologies to accomplish my goal? If I’m not, which direction should I go?

Thanks in advance.

Ken

stylusstudio
01-07-2006, 02:34 PM
HI Ken - XSLT is definately the way to go! While XSLT is typically used for transforming XML to some other structured, marked-up document (such as HTML or XHTML) -- there's nothing saying that the output *has* to be some other XML document-- Tab separated output format is fine, and in fact, quite typical for that matter. In a nutshell, your XSL stylesheet should just iterate through the xml data file using an xsl:for-each, and the output the values using xsl:value-of, separated by commas and printing out the [cr] or [lf] (line feed) character at the end of the xsl:for-each iteration. If you're struggling with XSLT, try using an XSLT Editor (http://www.************.com/xslt_editor.html). Hope that helps - let me know if you have any other questions.

Sincerely,
The Stylus Studio Team.
--
About Stylus Studio: Stylus Studio® is the industry's most innovative XML IDE (http://www.************.com/xml_product_index.html) providing advanced support for XML and its related technologies: XSL, XSLT (http://www.************.com/xslt.html), XML Schema (http://www.************.com/xml_schema.html) , DTD (http://www.************.com/dtd.html) , SOAP, WSDL, EDI (http://www.************.com/edi/) , EDIFACT (http://www.************.com/edifact/), SQL/XML, XML Mapping (http://www.************.com/xml_mapper.html) , Web services (http://www.************.com/web_services.html), Legacy data integration (http://www.************.com/xml_import_export.html) and XQuery (http://www.************.com/xquery.html). Used by leading software developers world-wide, Stylus Studio simplifies XML programming and enhances developer productivity (http://www.************.com/xml_benefits.html) through innovation. Visit the Stylus Studio (http://www.************.com) Web site to learn more.

stringman
01-09-2006, 08:24 AM
Thanks for the response. That was very helpful and should get me going.

pnr
08-08-2006, 01:15 AM
Hi

Please help me in converting an xml to a tab delimited text file.
How to achieve this?

Thanks & Regards,
Phani