views:

127

answers:

1

I have written a bash shell script that reads a directory and parses all the XML files in it in a for loop. I am taking each XML file and feeding it to xsltproc along with a xsl style sheet. The problem is some xml files are having non UTF 8 characters and the parser is unable to open those files. Parser error is thrown saying that UTF 8 encoding is expected.

Is there any option available where in i can instruct my xsltproc to process those files.

One more option is that is there any way i can ask my xsl to read only the tags that i want and not the whole xml file? is this the way xsl works or i may be wrong too

Please help me

A: 

If you can identify the non-UTF-8 files and know the encoding they are in, then processing those files with

iconv -f [encoding] -t UTF-8 < [file] | xsltproc ...

instead of a bare xsltproc invocation should do ya.

Zack