Applies Extensible Stylesheet Language (XSL) Transformation to XML data.

Example XML Functions (LR_XML)


lr.xmlTransform( {object} );

JavaScript Object

Property Name
xml The XML Input String to query.
stylesheet The XSL specifications. Has the format of an XSL string.
resultParam The name of the output parameter containing the XML formatted data after XSL transformation.

The lr.xmlTransform function transforms the XML input string XML using the Extensible Stylesheet Language (XSL) specifications in Stylesheet and saves the resulting formatted data in ResultParam, using the source document encoding. The output preserves the XML Character Encoding of the original document, independent of the input encoding. The input encoding uses the client's local encoding.

Return Values

All XML functions return the number of matches successfully found or zero on failure.


Input parameters to XML functions with the following names can be parameterized:

  • XML

  • Query

  • Value

  • XmlFragment


function Action(){
   var xmlInput =
       "<?xml version=\"1.0\" ?>"+
       "<heading>Acme Organization</heading>"+
       "<subhead>IT Management Report</subhead>"+
       "<description>Report by Department</description>"+

       var stylesheet =
       "<?xml version=\"1.0\"?>"+
       "<xsl:stylesheet xmlns:xsl=\"\" version=\"1.0\">"+
       "<xsl:output method=\"html\"/>"+
       "<xsl:template match=\"/\">"+
       "<TITLE><xsl:value-of select=\"//summary/heading\"/></TITLE>"+
       "<h1><xsl:value-of select=\"//summary/heading\"/></h1>"+
       "<h2><xsl:value-of select=\"//summary/subhead\"/></h2>"+
       "<p><xsl:value-of select=\"//summary/description\"/></p>"+

        lr.saveString(xmlInput, "XML_Input_Param"); // Save to a parameter
        lr.saveString(stylesheet, "XML_StyleSheet_Param");// Save to a parameter

        lr.xmlTransform({xml:"{XML_Input_Param}", resultParam:"Result",

        lr.outputMessage(lr.evalString("String after transformation: {Result}"));

return 0;