Transform XML to HTML with XSLT - OpenEdge 11.7.5 - Forum - OpenEdge Development - Progress Community

Transform XML to HTML with XSLT - OpenEdge 11.7.5

 Forum

Transform XML to HTML with XSLT - OpenEdge 11.7.5

This question is not answered

Hello All,

I am converting XML to HTML with XSLT as below, but getting error "System.Xml.Xsl.XslLoadException: The variable or parameter 'theV2' was duplicated within the same scope. "

But when I run saxon.sh for this it works fine without any error. Why is this and Is there any alternative for this code ?

DEF VAR lv-MyTransform AS System.Xml.Xsl.XslCompiledTransform NO-UNDO.

DEF VAR lv-myXSLTStringReader AS System.IO.StringReader NO-UNDO.
DEF VAR lv-myXMLStringReader AS System.IO.StringReader NO-UNDO.
DEF VAR lv-myStringWriter AS System.IO.StringWriter NO-UNDO.

DEF VAR lv-MyXMLReader AS System.Xml.XmlReader NO-UNDO.
DEF VAR lv-myXMLWriter AS System.Xml.XmlWriter NO-UNDO.

DEF VAR lv-XMLString AS LONGCHAR NO-UNDO.
DEF VAR lv-Output AS LONGCHAR NO-UNDO.
DEF VAR lv-XML-Doc AS HANDLE NO-UNDO.

CREATE X-DOCUMENT lv-xml-doc.

lv-xml-doc:LOAD("file", "D:\sample.xml", FALSE).
lv-xml-doc:SAVE("LONGCHAR", lv-XMLString).

lv-myXMLStringReader = NEW System.IO.StringReader(lv-xmlString).

lv-MyTransform = new System.Xml.Xsl.XslCompiledTransform().
lv-Mytransform:Load("D:\template.xsl").

lv-myStringWriter = NEW System.IO.StringWriter().

lv-MyXMLReader = System.Xml.XmlReader:CREATE(lv-myXMLStringReader).

lv-MyXmlWriter = System.Xml.XmlWriter:CREATE(lv-myStringWriter, lv-Mytransform:OutputSettings).

lv-Mytransform:Transform(lv-MyXMLReader,lv-myXMLWriter).

lv-Output = lv-myStringWriter:ToString().

OUTPUT TO "D:\output.html".
 EXPORT lv-Output.
OUTPUT CLOSE.

Thanks in advance.

All Replies
  • Does the XslTransform & XslCompiledTransform class only support XSLT 1.0 functions not XSLT 2.0

    I am getting few errors as below while using it with xslt file.

    System.Xml.Xsl.XslTransformException: 'abs()' is an unknown XSLT function.

    System.Xml.Xsl.XslTransformException: Expected end of the expression, found 'castable '.

    System.Xml.Xsl.XslTransformException: 'upper-case()' is an unknown XSLT function.

    any reference for this will be helpful