I have a long list of xml files which may have different encodings. I would like to go through all the files and print their encodings. Printing the encoding attribute in the XML header is just a first step. (The next step, once I find out how to get access to the encoding attribute would be to use the encoding attribute to test if this is the expecting encoding.)
This is how input xml files may look like:
<?xml version="1.0" encoding="iso-8859-1"?>
<Resource Name="text1" Language="de">
<Text>
</Text>
</Resource>
<?xml version="1.0" encoding="utf-8"?>
<Resource Name="file2" Language="ko">
<Text>
</Text>
</Resource>
The xsl, which has been cut down to a minimum but still without any success. I think I fail to match the XML header by writing this way. But how can I match something in the XML header?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="@encoding"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>