on 2021 Oct 20 4:54 PM
Hi,
I am trying to filter the records in SAP CPI if the end_date is ge a date(I am adding the date which is set earlier.It would be in format yyyy-MM-DD) in XSLT.But my condition is failing with conversion errors.
This is what I am trying to use:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="xml" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:param name="lastrun" select='2021-09-15'/>
<xsl:template match="/"> <Root>
<xsl:for-each select="/CompoundEmployee"> <xsl:if test="xs:date(person/employment_information[1]/end_date) ge xs:date('$lastrun')">
I am getting a error Invalid date "$lastrun" (Non-numeric year component).
I tried a lot of ways but not able to achieve this.
Any help is appreciated.
Request clarification before answering.
Hi Shruthi
$lastrun should not be in single quotes. With the quotes, you are passing the literal string "$lastrun" to the xs:date function. So it's not getting the contents of the property lastrun, which is what you want. Remove the quotes, and you are good to go.
I've written a blog post about filtering XML elements, which you can check out for further inspiration.
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
68 | |
15 | |
12 | |
7 | |
7 | |
4 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.