I am trying to convert text files to XML files using XSLT. I started working with CSV files because it is a well-known file format that I could run in Google examples.
I came across this: http://ajwelch.blogspot.com/2007/02/csv-to-xml-converter-in-xslt-20.html , which also points to http://andrewjwelch.com/code/xslt /csv/csv-to-xml_v2.html .
These links allegedly contain XSLT (2.0), which can take a CSV file and convert it to an XML file.
... Except that it really doesn't work.
I installed it in my Maven Eclipse project, downloaded the latest Saxon dependency (9.4 HE) and tried to use it. I was met with this error:
Error in row 1 of column 1 of csv.csv:
SXXP0003: error reported by the XML parser: content is not allowed in the prolog.
It seems to me that when he began to parse the file, he hit the first character, found that it was not a character <, exclaimed to himself. "This is not an XML file! The double tee eff, buddy! And exploded. Which type works contrary to the idea that this XSLT should work with non-XML files (namely, CSV files). Forcing you to wrap non-XML in an XML tag so that he completely cancels the target.
At first I thought that the problem was that I did not use the Saxon can directly on the command line, as in the example. So I did just that. The result is something familiar:
Error in row 1 of column 1 of csv.csv:
SXXP0003: error reported by the XML parser: content is not allowed in the prolog.
, , , , , , . SaxonB 9.1.0.8 Eclipse, . , ?
1 1 csv.csv:
SXXP0003: , XML: .
, CSV xml- (, <whatever>item1,item2,item3</whatever>), ( , , ).
, , XSLT ? , ( ), , , ? , Ubuntu qaru.site/questions/1911464/.... ? !
, / , , , , , , XSLT CSV XML.
, - , ?
: pgfearo . "" : Saxon in Java: XSLT CSV XML
2: - , XSLT, : XSLT remove()