vipasane Posted June 15, 2011 Share Posted June 15, 2011 If my source xml file has encoding="ISO-8859-1" is there a way to convert it forexample to UTF-8 though XSLT ?If so how could that be done?Thank you for reading so far, any help would be appreciated Link to comment Share on other sites More sharing options...
Martin Honnen Posted June 15, 2011 Share Posted June 15, 2011 You can transform XML to XML with the help of XSLT and you can specify the output enoding: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" encoding="UTF-8"/> <xsl:template match="/"> <xsl:copy-of select="."/> </xsl:template></xsl:stylesheet> Depending on your XML input that approach can have shortcomings however as it does not copy the input unchanged to the output but rather parses the XML input into the tree model of XSLT/XPath and copies that tree to the output. As the XSLT/XPath data model does not model all kind of nodes an XML document can have, such as DOCTYPE nodes or CDATA section nodes, the output can look different from the input (e.g. the DOCTYPE would be dropped and CDATA sections would be replaced with text nodes with escaped characters). Link to comment Share on other sites More sharing options...
vipasane Posted July 8, 2011 Author Share Posted July 8, 2011 So yep silly me, thanks for your help and for clearing this up for me.It turned out that I already implemented this.This is what you get when you don't fully understand technology or method you're utilizing Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.