Remove first line from text file using XSLT
4 answers
Yes, you can accomplish what you want in XSLT!
In XSLT 2.0, it would be easier to do this if that's the option for you. Michael Kay answered a similar question on the XSL mailing list in 2005.
To paraphrase his answer, with small examples:
In XSLT 2.0 : you can use the unparsed-text () function to read the file, tokenize () to split it into lines (and just ignore the first line).
<xsl:for-each select="tokenize(unparsed-text($in), '\r?\n')">
...
</xsl:for-each>
In XSLT 1.0 : You can read a flat text file by pretending to be the XML of an external object and referencing it from an XML document that calls the object to be expanded.
<!DOCTYPE foo [
<!ENTITY bar SYSTEM "bar.txt">
]>
<foo>
&bar;
</foo>
+4
source to share