To enable C#, add the following namespace in the XSL header element: (underlined)
<xls:stylesheet version="1.0" " xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:CSharp="http://script.caleaccess.com/CSharp/" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
To use C# scripts, you need to add the following element within the XSL:StyleSheet element:
<msxsl:script implements-prefix="CSharp" language="C#">
<![CDATA[
{C# function goes here}
]]>
</msxsl:script>
It should be noted that date / time values will differ in their format from the EU and NA environment because both environments use different culture settings. On the EU environment, the time format will be HH:mm:ss by default, where in NA it will be hh:mm:ss tt. Using CSharp script this can be configured as seen in the following example:
The value of a field will be changed by calling the C# function with "CSharp:function(FieldToProcess)"
Example using the US culture info:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:CSharp="http://script.caleaccess.com/CSharp/" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>PARKING RECEIPT</xsl:text>
<xsl:text> </xsl:text>
<xsl:text>End time: </xsl:text>
<xsl:value-of select="CSharp:getTimeStamp(/PurchaseReceipt/Purchase/EndDateLocal/@Value)"/>
<xsl:text> </xsl:text>
<xsl:text>Start time: </xsl:text>
<xsl:value-of select="CSharp:getTimeStamp(/PurchaseReceipt/Purchase/StartDateLocal/@Value)"/>
<xsl:text> </xsl:text>
<xsl:text>LPN: </xsl:text>
<xsl:value-of select="/PurchaseReceipt/Purchase/Code/@Value"/>
<xsl:text> </xsl:text>
<xsl:text>Meter ID: </xsl:text>
<xsl:value-of select="/PurchaseReceipt/Terminal/TerminalID/@Value"/>
<xsl:text> </xsl:text>
<xsl:text>Amount: </xsl:text>
<xsl:value-of select="/PurchaseReceipt/Purchase/Amount/@Value"/>
</xsl:template>
<msxsl:script implements-prefix="CSharp" language="C#">
<![CDATA[
public string getTimeStamp(string value)
{
DateTime valueDate = DateTime.Parse(value);
return valueDate.ToString("yyyy-MM-dd hh:mm:ss tt", new System.Globalization.CultureInfo("en-US"));
}
]]>
</msxsl:script>
</xsl:stylesheet>