Server-side Scripting

Attention! Available only for Super Module mode.

Server-side scripting is based on msxsl:script tag. Review original documentation here: XsltDb just makes some declarations and enables this tag only for super modules. Here is a sample of declaring and using a compareString function that allows you to compare strings case sensitive or case insensitive

<msxsl:script language="C#" implements-prefix="script">
  public int compareString(string s1, string s2, bool ignoreCase)
    return String.Compare(s1, s2, ignoreCase);

<xsl:template match="/">
  Result: <xsl:value-of select="script:compareString('qwe', 'QWE',  true())"/>
  Result: <xsl:value-of select="script:compareString('qwe', 'QWE', false())"/>
When you use a short form of xslt (wthout xsl:stylesheet element) XsltDb adds xmlns:script declaration, so you can use it for scripting by specifying in implements-prefix attribute. If you create xsl:stylesheet element manually you can use any prefix you want.

Last edited Jun 20, 2010 at 3:23 PM by findy, version 2


No comments yet.