XSLT Extension Functions: Difference between revisions

From Commander4j
Line 74: Line 74:
Example usage
Example usage


  <xsl:value-of select='c4j_XSLT_Ext:padEAN(c4j_XSLT_Ext:trim(string($string1)))'/>
  <xsl:value-of select="c4j_XSLT_Ext:padEAN(c4j_XSLT_Ext:trim(string($string1)))"/>


===padStringLeft===
===padStringLeft===

Revision as of 08:15, 10 September 2024

The Middleware Appliction is bundled with the Saxon-HE library

The open-source [Saxon-HE] product is offered under the [Mozilla Public License version 2.0.]

A number of Extension (Java) functions are available to the middleware and these are documented here.

In order to be able to reference these functions in your XSLT you would need to delcare them as shown here.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:xs="http://www.w3.org/2001/XMLSchema" 
                xmlns:c4j="http://www.commander4j.com" 
                xmlns:c4j_XSLT_Ext="http://com.commander4j.Transformation" 
                xmlns:saxon="http://saxon.sf.net/"
                exclude-result-prefixes="xs c4j c4j_XSLT_Ext" 
                version="2.0">
  xmlns:c4j="http://www.commander4j.com" 
  xmlns:c4j_XSLT_Ext="http://com.commander4j.Transformation" 
  exclude-result-prefixes="xs c4j c4j_XSLT_Ext" 

ISO_Date_to_date_DDMMYYYY

Example usage

<xsl:value-of select="c4j_XSLT_Ext:ISO_Date_to_date_DDMMYYYY($inputdate)" />

Parameter format : yyyy-MM-dd HH:mm:ss

ISO_Date_to_date_DD_MM_YYYY_HH_MM_SS

Example usage

<xsl:value-of select="c4j_XSLT_Ext:ISO_Date_to_date_DD_MM_YYYY_HH_MM_SS($inputdate)" />

Parameter format : yyyy-MM-dd HH:mm:ss

ISO_Date_to_date_MMYYYY

Example usage

<xsl:value-of select="c4j_XSLT_Ext:ISO_Date_to_date_MMYYYY($inputdate)" />

Parameter format : yyyy-MM-dd HH:mm:ss

concat

Example usage

<xsl:value-of select="c4j_XSLT_Ext:concat($string1,$string2)" />

date_DD_MMM_YY_to_ISO_Date

date_DD_MM_YY_HH_MM_SS_to_ISO_Date

date_DDMMYYYY_to_ISO_Date

formatDate

getISODateTimeFilenameString

getISODateTimeString

getUUID

Example usage

<xsl:value-of select="c4j_XSLT_Ext:getUUID()" />

lowercase

Example usage

<xsl:value-of select="c4j_XSLT_Ext:lowercase($string1)" />

nvl

Example usage

<xsl:value-of select="c4j_XSLT_Ext:nvl($string1,$string2)" />

padEAN

Example usage

<xsl:value-of select="c4j_XSLT_Ext:padEAN(c4j_XSLT_Ext:trim(string($string1)))"/>

padStringLeft

padStringRight

padVariant

removeCommas

Example usage

<xsl:value-of select="c4j_XSLT_Ext:removeCommas($string1)" />

removeLeadingZeros

Example usage

<xsl:value-of select="c4j_XSLT_Ext:removeLeadingZeros($string1)" />

removeSpaces

Example usage

<xsl:value-of select="c4j_XSLT_Ext:removeSpaces($string1)" />

subString

Example usage

<xsl:value-of select="c4j_XSLT_Ext:subString($string1,startpos,length)" />

trim

Example usage

<xsl:value-of select="c4j_XSLT_Ext:trim($string1)" />

uppercase

Example usage

<xsl:value-of select="c4j_XSLT_Ext:uppercase($string1)" />