Have a plain text file with terms and conditions mentioned in it. Have to read it in XSL. How can this be done?
Asked
Active
Viewed 275 times
0
-
Do you have to do this with XSLT? Maybe at least a pre-processing step to transform the input into XML? What do you need to do with the input file? Just copy/include verbatim or process somehow? – Thilo May 05 '16 at 11:48
-
I Just need to display the file as it is. The reason input is taken as a file is so that the file can be easily modified. – Mufaria Razak May 05 '16 at 11:50
-
I already have a XML file which is generated by the system. But the requirement is not to include the contents in the XML. Instead, take it from an input text file. – Mufaria Razak May 05 '16 at 11:53
-
Yes have to do it with XSLT. – Mufaria Razak May 05 '16 at 12:00
-
1Possible duplicate of [Regular text file to XML using XSLT](http://stackoverflow.com/questions/5675889/regular-text-file-to-xml-using-xslt) – kjhughes May 05 '16 at 13:16
1 Answers
0
Providing you are using an XSLT 2.0 (or later) processor such as XmlPrime or Saxon 9, you can use the unparsed-text function. Quoting the specification:
"The fn:unparsed-text function reads an external resource (for example, a file) and returns a string representation of the resource."

Tim Mills
- 46
- 1
-
Unfortunately I'm using XSLT 1.0. It will require unnecessary time for transforming text file to XML format. – Mufaria Razak May 09 '16 at 05:27