Project

Profile

Help

Support #4264 » function_warning.xslt

Stefan Pöschel, 2019-07-31 09:22

 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:test="http://test.test" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:function name="test:string_to_amount" as="xs:decimal">
<!-- returns the amount part of a string, as a number -->
<xsl:param name="s" as="xs:string"/>
<xsl:value-of select="xs:decimal(replace($s, '^([-+]?\d*\.?\d+).*$', '$1'))"/>
</xsl:function>
<xsl:template match="/">
<xsl:value-of select="test:string_to_amount('1234.56%')"/>
</xsl:template>
</xsl:stylesheet>
    (1-1/1)