Entering content frame

Function documentation Integration with Scripting Languages Locate the document in its SAP Library structure

Use

Allows execution of scripts in virtually any scripting language that offers a scripting engine, compatible with the Bean Scripting Framework (BSF). Also allows function calls for the functions in the script. Short example is described below:

Example

<?xml version="1.0"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0"
    xmlns:my-ext="ext1"
    extension-element-prefixes="my-ext">
   
  <xsl:script language="javascript" implements-prefix="my-ext">
      var multiplier=2;
     
      function timelapse() {return 4;}
      function getdate(numdays)
      {
        var d = new Date();
        var totalDays = parseInt(numdays) * multiplier;
        d.setDate(d.getDate() + totalDays);
        return d.toLocaleString();
      }
  </xsl:script>
 
     
  <xsl:template match="deadline">
    <p><my-ext:timelapse multiplier="4"/>We have logged your enquiry and will
      respond by <xsl:value-of select="string(my-ext:getdate(string(@numdays)))"/>.</p>
  </xsl:template>

</xsl:stylesheet>

The script has to be situated in a top-level <xsl:script> element, with its language specified as an attribute.

 

Leaving content frame