How to add a stylesheet to and xml from progress

lordcold

New Member
Hi, everyone, I have a question , perhaps it's a silly one. Well I have a procedure that creates a xml file, at this point everything works good. Now, I've made an XSL file for those XML files. My question is, How can I attach the XSL file to the XML from Progress?. Actually I do it "manually", I mean, I have to open the XML file and add the line wich links it to the stylesheet.
 
Code:
DEFINE VARIABLE hDoc AS HANDLE.
DEFINE VARIABLE hRoot AS HANDLE. 
DEFINE VARIABLE hRoot1 AS HANDLE. 
DEFINE VARIABLE cxsl AS CHARACTER INIT "dummy.xsl".
 
CREATE X-DOCUMENT hDoc.
CREATE X-NODEREF hRoot.
CREATE X-NODEREF hRoot1.      
 
lreturnValue = hPDS:WRITE-XML ("handle", hdoc, NO, ?, ?, NO, FALSE, FALSE ).
hDoc:GET-DOCUMENT-ELEMENT(hRoot1).  
hDoc:CREATE-NODE(hRoot, "xml-stylesheet":U, "PROCESSING-INSTRUCTION":U).
hRoot:NODE-VALUE = "type=~"text/xsl~" href=~"dummy.xsl~"":U.
hDoc:INSERT-BEFORE(hRoot, hRoot1).
lreturnValue = hDoc:SAVE ("FILE", cFile ).
 
Back
Top