0

I have some code in PHP which I need to translate into Delphi:

$xsl = new DOMDocument();
$xsl->load('http://www.fda.gov/oc/datacouncil/stylesheets/spl/spl.xsl');
$proc = new XSLTProcessor();
$proc->importStylesheet($xsl);
$xml = new DOMDocument();
$xml->load($xmlFile);
$domTranObj = $proc->transformToDoc($xml);
$strHTML = $domTranObj->saveHTML();

What I need to do is take a snippet of XML (from a database field), transform it using the .xsl translation document, and then save the whole thing back into the data field as HTML.

Does anyone know how to do this in Delphi?

1
Contributor
1
Reply
3
Views
7 Years
Discussion Span
Last Post by agrarian
0

I'm getting closer! It looks like Delphi uses the XSLPageProducer to transform XML using an XSL file. However, the result I'm getting is translated text, but without any of the html tags! My code so far:

XSLPageProducer1.Active := False;
XSLPageProducer1.FileName := 'spl.xsl';
strXML := ADOTable1.FieldByName('Field1').Value;
if (strXML <> '') and not (strXML = null) then begin
  XMLDocument1.LoadFromXML(strXML);
  XSLPageProducer1.XMLData := XMLDocument1;
  XSLPageProducer1.Active := True;
  ShowMessage(XSLPageProducer1.Content);
  ADOTable1.Edit;
  ADOTable1.FieldByName('Field1').Value := XSLPageProducer1.Content;
  ADOTable1.Post;
end;

Any ideas why I'm not getting any html tags?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.