Hi everybody, I am using MSXML parser and use encoding ISO8859_1 but occurs
this error --> Loading XML File - System does not support the specified
encoding.'encoding ISO8859_1 Line 1 Column 53

procedure TForm1.XSLTransform(input, output, ss: string);
var
FDOMDoc: DOMDocument;
FXSLTemplate: XSLTemplate;
FXSLDoc: FreeThreadedDOMDocument;
FXSLProc: IXSLProcessor;
// uc: UnitConverter;
i: integer;
outfile: TFileStream;
x : String;
begin
CoInitializeEx(nil, COINIT_APARTMENTTHREADED);
FDOMDoc := CoFreeThreadedDOMDocument40.Create;
FXSLTemplate := CoXSLTemplate40.Create;
FXSLDoc := CoFreeThreadedDOMDocument40.Create;

try
FXSLDoc.async := false;
FXSLDoc.validateOnParse := true;
FXSLDoc.resolveExternals := true;
FXSLDoc.preserveWhiteSpace := false;
FXSLDoc.load(ss);

FDOMDoc.async := false;
FDOMDoc.validateOnParse := true;
FDOMDoc.resolveExternals := true;
FDOMDoc.preserveWhiteSpace := false;
FDOMDoc.load(input);

try
if (FDOMDoc.parseError <> nil) and (FDOMDoc.parseError.errorCode
<> 0) then
raise Exception.Create('Loading XML File - ' +
FDOMDoc.parseError.reason +
' Line ' +
IntToStr(FDOMDoc.parseError.line) +
' Column ' +
IntToStr(FDOMDoc.parseError.linepos));
if (FXSLDoc.parseError <> nil) and (FXSLDoc.parseError.errorCode
<> 0) then
raise Exception.Create('Loading XSL Stylesheet - ' +
FXSLDoc.parseError.reason + ' Line ' +
IntToStr(FXSLDoc.parseError.line) +
' Column ' +
IntToStr(FXSLDoc.parseError.linepos) +
' (' + './' + ss + ')');

try
FXSLTemplate.stylesheet := FXSLDoc;
FXSLProc := FXSLTemplate.createProcessor;

// Create a pointer to the IUnitConverter interface
// uc := CoUnitConverter.Create;

// I think I'm having problems here
// FXSLProc.addObject(uc, 'urn:convlib');
FXSLProc.input := FDOMDoc;

outfile := TFileStream.Create(output, fmCreate or
fmShareExclusive);
FXSLProc.output := TStreamAdapter.Create(outfile) as IStream;

if not FXSLProc.transform then
begin
// get transformation error messages here
raise Exception.Create('Error during Transform.');
end;
// x := FXSLProc.output;
// Memo1.Lines.Text := x;


finally
// uc := nil;
// For some reason this call doesn't work
{ if Assigned(FXSLProc) then
FXSLProc.addObject(nil, 'urn:convlib'); }
FXSLProc := nil;
if Assigned(outfile) then
outfile.Free;
end;
except
on E: Exception do
begin
x := e.Message;
ShowMessage(e.Message);
end;
end;
finally
FDOMDoc := nil;
FXSLTemplate := nil;
FXSLDoc := nil;
end;
end;

What have I done wrong or what have I done for solution this error?

Kind regards.

Gustavo Cardona Ramírez
Product Manager - Cofounder
Mentat Technologies

Those who would give up essential liberty, to purchase a little temporary
safety, deserve neither liberty nor safety.

--Benjamin Franklin