Hot to call C# function inside XSLT ?

  • Thread starter Thread starter Maxim Kazitov
  • Start date Start date
here is a short sample that should get you started

<xsl:for-each select="Ledger/*"><xsl:value-of select="user:Total(.))"/
xsl:for-each><msxsl:script implements-prefix='user' language='C#'
decimal balance = 0

void Total(XPathNodeIterator iter)
XmlNode node = e.NextNode()
string s = node.SelectSingleNode("amount").InnerText
decimal amount = Decimal.Parse(s)
if (node.Name == “deposit†|| node.Name == “balanceâ€
balance += amount
els
balance -= amount
return balance

]]
msxsl:script

ht
jayson
 
Back
Top