I have an xml with invoice date: Is it possible in a script to select only invoices dated today ?
2024-03-06T14:45:00Z
I have an xml with invoice date: Is it possible in a script to select only invoices dated today ?
2024-03-06T14:45:00Z
To be honest, Iām not a XSLT expect but I assume that this can be accomplished by the following steps:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/records">
<xsl:copy>
<xsl:apply-templates select="record[date[starts-with(text(), '%{currentDate}')]]"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
In performing the above steps, I have assumed that the XML file contains the following content:
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record>
<date>2024-03-06T14:45:00Z</date>
<name>Jane Doe</name>
</record>
<record>
<date>2024-04-05T16:16:00Z</date>
<name>John Doe</name>
</record>
</records>
Result:
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record>
<date>2024-04-05T16:15:00Z</date>
<name>John Doe</name>
</record>
</records>
I managed this using a Condition and Action step in DataMapper.
date.xml (820 Bytes) today.OL-template (7.2 KB) today.pdf (3.0 KB) todays date.OL-datamapper (4.2 KB)
The condition:
thks Marten, I will try this
Thks Erik. I will try