How to add number of days Count on XSLT 1

Mahesh Madhusanka 106 Reputation points
2020-09-17T18:43:12.517+00:00

Hi Team,

Currently we have a requirement to add a number of date count on XSLT 1.0 date mapping, According to currently we have xpath value related to particular date and need to add additional days count on that, Could you please support on this, for your reference here with attached Current Source sample/ Current XSLT part and Expected output.

Source Xml -
<invoice>
<Invoice_No>00264838</Invoice_No>
<Charge_Details>
<Charge_Detail_Item>
<House_Bill>14020117208</House_Bill>
<Master_Bill>0NNT6W1MA</Master_Bill>
<Container_No>APZU3536779</Container_No>
<Charge_Code_List>
<Charge_Code_Item>
<Charge_Code>WARHANDL</Charge_Code>
<OS_Cost_Amt>670</OS_Cost_Amt>
</Charge_Code_Item>

            </Charge_Code_List>
        </Charge_Detail_Item>
    </Charge_Details>

    <InvoiceDate>2020-09-08</InvoiceDate>
    <Operator_Action_Code>1</Operator_Action_Code>
</invoice>

Current Sample XSLT Line -

<CostInvoiceDate><xsl:value-of select="/invoice/InvoiceDate"/></CostInvoiceDate>  

Current Output

<CostInvoiceDate>2020-09-08</CostInvoiceDate>

Expected Result after adding 20 days on exsisting Date (+20 days)

<CostInvoiceDate>2020-09-28</CostInvoiceDate>
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,872 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yitzhak Khabinsky 25,116 Reputation points
    2020-09-17T19:31:39.027+00:00

    Hi Mahesh,

    Please try the following solution for XSLT 1.0.

    XML
    <?xml version="1.0"?>
    <invoice>
    <Invoice_No>00264838</Invoice_No>
    <InvoiceDate>2020-09-08</InvoiceDate>
    <Operator_Action_Code>1</Operator_Action_Code>
    </invoice>

    XSLT

    Unfortunately, the forum doesn't allow me to add a legit and working XSLT.
    Both, directly or as attachment.

    25600-mahesh-2020-09-17-164437.png

    Output XML

    <?xml version="1.0" encoding="utf-8"?>  
    <invoice>  
      <before>2020-09-08</before>  
      <after>2020-09-19</after>  
    </invoice>  
    

0 additional answers

Sort by: Most helpful