I have the following lines of XSLT. When i try to transform my xml doc I receive the following:
Cannot find a 1-argument function named Q{urn:js}RoundOff()
I believe that there is no issue with the actual script just something that I need to change in the parser setting but I am not sure what to or where to change these settings.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:js="urn:js"
exclude-result-prefixes="msxsl js">
<msxsl:script language="JavaScript" implements-prefix="js">
<![CDATA[
function roundOff(hours) {
return Math.round(hours * 100) / 100;
}
function getPeriodEndDate() {
var today = new Date();
var dayOfWeek = today.getDay();
var tdate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
if (dayOfWeek === 0) {
tdate.setDate(tdate.getDate() - 1);
} else if (dayOfWeek === 1) {
tdate.setDate(tdate.getDate() - 2);
} else if (dayOfWeek === 2) {
tdate.setDate(tdate.getDate() - 3);
} else if (dayOfWeek === 3) {
tdate.setDate(tdate.getDate() - 4);
} else if (dayOfWeek === 4) {
tdate.setDate(tdate.getDate() - 5);
} else if (dayOfWeek === 5) {
tdate.setDate(tdate.getDate() - 6);
}
var year = tdate.getFullYear();
var month = tdate.getMonth() + 1;
var day = tdate.getDate();
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
return year + month + day;
}
]]>
</msxsl:script>```
....
<Additional lines of xsl>
....
<xsl:value-of select="js:RoundOff(SickHoursAccrued + SickHoursUsed)" />
Assistance in editing or changing settings to allow the xslt to parse without errors