Using XSLT transformation I want to convert an XML file, that in turn represents various chunks of another file, into a HTML file with a link to the file that was represented.
Input XML File:
<File>
<Name>foo.jpg<Name>
<Chunk>
<Offset>200</Offset>
<Length>100</Length>
<Data>
<![CDATA[data bytes, encoded in base64, can be greater than length 100 too, but first 100 decoded bytes are valid.]]>
</Data>
</Chunk>
<Chunk>
...
</File>
The output should be a html file that has a valid link to foo.jpg, i.e., there is another implicit output file called "foo.jpg" with data from the cdata sections in the chunks, at their specified offsets.
<html>
<body>
<a href="http://example.com/images/foo.jpg">file</a>
</body>
</html>
This XSLT 2.0 transformation:
when applied on this XML document (having two chunks):
produces the wanted, correct result:
and the created file:
c:\temp\delete\foo.jpg
has the correct, wanted contents: