As .NET developer I must work with Web Services and XML, where usually I build basic XSL and XSL-FO templates.
The encoding attribute in the xml processing instruction is the standard way to define declare the document encoding in XML documents.
<?xml version="1.0" encoding="UTF-16"?>
While I was working with XSL-FO, I get an transformation exception: Content is not allowed in prolog. Without any detail, and using the force, I’ve seen that the problem was the encoding processing instruction attribute.
After passing the FO template to the converter, I’ve replaced the encoding="UTF-16" processing instruction attribute with an empty string.
Dim finalXslFo As String = processingFoXsl.Replace(" encoding=""UTF-16""", String.Empty)
Finally, the result was a working but ugly hacked XSL-FO template…



