ne peut pas simplement "aXSLProc.Process(aCursor);"
[Delphi +TXMLCursor +TXSLProc]
Bonjour,
je n'arrive pas à obtenir le résultat souhaité lorsque je veux transformer un TXMLCursor (par aXSLProc.Process(aCursor);). Pour arriver à mes fins, je suis obligé, avant la transformation, de "recharger" mon TXMLCursor avec la méthode "aCursor.LoadXML(aXMLString);"
pour info, voici mon code source en Delphi:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
procedure aProc;
var
aDocument,
aCursor: IXMLCursor;
XPath: string;
aXSLProc: IXSLProc;
s: string;
begin
try
aDocument := TXMLCursor.Create;
aDocument.Load('test.xml');
s := aDocument.xml;
XPath := '//msg[@id=''10'']'; //set whatever path
aCursor := aDocument.Select(XPath);
s := aCursor.xml;
///////////////////////////////////////////
/// why need to re-load s into XML ?? ///
///////////////////////////////////////////
aCursor.LoadXML(s);
aXSLProc := TXSLProc.Create;
aXSLProc.Load('test.xsl');
s := aXSLProc.Process(aCursor);
finally
aCursor := nil;
aDocument := nil;
aXSLProc := nil;
end;
end; |
Quelqu'un obtient-il le même comportement?
Est-ce là le comportement normal du TXSLProc?
PS: je tiens à disposition éventuellement les fichiers xml et xsl ayant servi à l'exemple.
Merci