I am new to XSLT code and need experties help. I have got a requirement to generate the beginning of the month dynamically from 2018-10-01 (YYYY-MM-DD) till previous month beginning of the month i.e 2019-04-01 (current month is May1st). So every month when we run this XSLT code will add the previous month into the snippet.
I tried using below function also included namespaces as below xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:functx="http://www.functx.com" xmlns:fn="http://www.w3.org/2005/xpath-functions".
But it is saying "Cannot find a 2-argument function named {http://www.functx.com}yearMonthDuration()". I am using this with Oxygen XML editor.
Expected Output:
<?xml version="1.0" encoding="UTF-8"?>
<Year>
<Month>2018-10-01</Month> <Month>2018-11-01</Month> <Month>2018-12-01</Month> <Month>2019-01-01</Month> <Month>2019-02-01</Month> <Month>2019-03-01</Month> <Month>2019-04-01</Month> </Year>
yearMonthDuration
is a datatype, not a function. You probably want to use thesubtract-yearMonthDuration-from-date()
function. Note that this requires an XSLT 2.0 processor. Oxygen is a testing environment that features several XSLT processors; you must use one that supports XSLT 2.0 or higher. – michael.hor257kadd-yearMonthDuration-to-date()
. But it's not necessary, because you can just use the+
and-
operators instead. – michael.hor257kxsl:include
. – Michael Kay