Using EXSLT extension objects with Ibex .NET

Using the .Net version of Ibex PDF Creator you can extend the functionality of the .NET XSLT processor.

In this example we use the EXSLT extensions, the home page for which is

The EXSLT extensions provide functions such as date and time handling which can be invoked as part of XSLT translation.

This example shows how to link the EXSLT extensions with your application and invoke its functions from an XSL stylesheet.


EXSLT ships as a .NET assembly. We need to:

  • link this assembly to our application
  • tell Ibex the namespace used for EXSLT
  • pass Ibex an object which implements the ESXLT extensions
  • modify our stylesheet to call the EXSLT functions.

Downloading EXSLT

The version of EXSLT used in this example is called Mvp.Xml.Dll and was downloaded from Additional information can be found at

Linking EXSLT with the application

In this example we use a simple command line program called ExsltExample.cs, which calls Ibex like this:

using System;
using System.IO;
using System.Collections;

using ibex4;

using Mvp.Xml.Exslt;

public class test {
   static void Main( string[] args ) {
        FODocument doc = new FODocument();

        FileStream xml = new FileStream( "exslt.xml", FileMode.Open, FileAccess.Read );
        FileStream xsl = new FileStream( "exslt.xsl", FileMode.Open, FileAccess.Read );
        FileStream pdf = new FileStream( "exslt.pdf", FileMode.Create, FileAccess.Write );

        Hashtable xslArgs = new Hashtable();

        xslArgs.Add( "", new ExsltDatesAndTimes() );

        doc.generate( xml, xsl, pdf, true, xslArgs );

This program is compiled from the command line and linked with EXSLT using the command:

csc /r:ibex20.dll /r:Mvp.Xml.dll ExsltExample.cs

This program does a number of things to support using EXSLT:

  • we reference the EXSLT namespace with using Mvp.Xml.Exslt;
  • we tell Ibex about EXSLT by creating a Hashtable of arguments for the XSLT process, adding an instance of the ExsltDatesAndTimes object to that hashtable, and passing the hashtable to the Ibex generate() method.

Invoking EXSLT in the stylesheet

The data used in this simple example looks like this:

<?xml version="1.0" encoding="UTF-8"?>
  <city name="Wellington" temp="20"/>
  <city name="Auckland" temp="5"/>
  <city name="London" temp="22"/>

The stylesheet used to transform this data is:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"  

<xsl:strip-space elements="*"/>

<xsl:template match="forecast">
      <simple-page-master master-name="page-layout">
        <region-body margin="2.5cm" region-name="body"/>

    <page-sequence master-reference="page-layout">
      <flow flow-name="body">
          Printed on <xsl:value-of select="date:date()"/>
        <xsl:apply-templates select="city"/>

<xsl:template match="city">
    <xsl:value-of select="@name"/>


In this stylesheet we need to tell the .NET XSLT processor about the EXSLT namespace. This is done by adding the namespace declaration to the xsl:stylesheet element like this:

<xsl:stylesheet version="1.0"  

We can then invoke the functions of the ESXLT object like this:

Printed on <xsl:value-of select="date:date()"/>


Downloads for this example are:

The XML file exslt.xml.

The XSL file exslt.xsl.

Copyright (c) 2002-2016 Visual Programming Limited