How to convert .csv file to xml using XSLT 1.0?

橙三吉。 提交于 2019-12-03 21:52:05

What you're asking for (CSV to XML) cannot be done with XSLT.

From wikipedia:

XSLT (Extensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents, or other objects such as HTML for web pages, plain text or into XSL Formatting Objects which can then be converted to PDF, PostScript and PNG.

XSLT can take a source XML document and transform it into a different document (usually XML, but it could be anything), but XSLT is not an appropriate tool for converting CSV data into a different format.

You probably could do it with some of the string manipulation functions, but I strongly advise against that. Especially if your schema just basically amounts to:

<row>
    <column /><column /><column /><column />...
</row>
....

You really don't need XSLT for something that simple. Use the right tools for the job, and this is not a job for XSLT, judging by the information given.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!