So here is how I did it.
To recap. I wanted to include the xsl-stylesheet in the xml document
that is produced by XMLExecute(). Below is the code that produced the
desired result.
PROGRAM STDCSTXML
$OPTIONS INFORMATION
$INCLUDE UNIVERSE.INCLUDE XML.H
;* CMD is the paragraph that we want to run
;* OPTIONS are the paramters that you would normally pass to TOXML
CMD = "SORT STOCKFILE WITH QTY GT 0 DESC UM STATDESC QTY STD.CST
TOTAL TOTCST"
OPTIONS = "ELEMENTS"
STATUS = XMLExecute(CMD,OPTIONS,XML.VAR,XSD.VAR) ;* XML.VAR
holds the variable that we'll use to create a dynamic array (DA)
PARSE = XML.VAR ;* PARSE is now the DA
PARSE = CONVERT('>',@VM,PARSE) ;* Use CONVERT function to
convert all ending '>' in each XML elemetn to Value Marks
LOCATE '?' IN PARSE<1,1> SETTING X ELSE ;* dimension the DA and
find the first ? in the DA
;* Insert the new XML stylesheet element into the DA
PARSE = INSERT(PARSE,1,2,0,'<?xml-stylesheet type="text/xsl"
href="http://cicnet.celestecorp.com/cms/xml/xslt/cilstdcst.xsl"?')
END
PARSE = CONVERT(@VM,'>',PARSE) ;* convert the VM's back to '>'
OPEN '','XMLREPORTS' TO FILE THEN ;* Open the folder and write to it.
WRITE PARSE TO FILE, 'stdcst.xml'
END
END ;*Rinse, repeat, =)
I'll also add that I created the file called XMLREPORTS as a Type 19,
then edited the voc record for XMLREPORTS to actually point to a
shared folder on our Intranet web server.
This works flawlessly for me and I hope that it may also help someone
else in the future. Oh and management loves it and is now wanting to
do this for a lot of general purpose reports.
Enjoy,
Norm
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users