Example 5-28: Modified submissionXML function uses the xslt helper package

CREATE OR REPLACE FUNCTION submissionXML( id NUMBER ) RETURN VARCHAR2 IS
  query      VARCHAR2(100);
  queryXML   xmldom.DOMDocument;
  stylesheet xslprocessor.Stylesheet;
  retval     VARCHAR2(32767);
BEGIN
  query := 'select *
              from accepted_submission
             where id = :id';
  xmlgen.clearBindValues;
  xmlgen.setBindValue('id',id);
  -- (1) Create the stylesheet from TechnicalPaper.xsl loaded by
  --     name from the xml_documents table.
  stylesheet := xslt.stylesheet(xmldoc.get('TechnicalPaperTransform'));
  -- (2) Transform the xmlgen.getXML(query) results by the stylesheet,
  --     passing the value of "XML Europe" for the top-level stylesheet
  --     parameter named 'Conference'
  retval := xslt.transform(xmlgen.getXML(query),
                           stylesheet,
                           xslt.params('Conference','XML Europe'));
  -- (3) Free the stylesheet
  xslt.freeStylesheet(stylesheet);
  -- Return the transformed result
  RETURN retval;
END;