SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 22-11-2018 07:07:34

Registered: 20-11-2018
Posts: 148

XSLT Stylesheets - Split monetary value into Rands and Cents

This stylesheet take a monetary value in an element named "price" and separates the Rand and Cents values into individual elements

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

	<xsl:template match="/">
		<xsl:variable name="s" select="//*[local-name()='price']" />
		<cents><xsl:value-of select="substring($s, string-length($s) - 1,2)" /></cents>
		<Rands><xsl:value-of select="substring($s, 1, string-length($s) - 2)" /></Rands>


Board footer

Powered by FluxBB