英文:
How to create code on XSLT in ver 3.0 to calculate only business days (i.e excluding Saturday and Sunday )?
问题
I can help you with the translation:
我有这段代码。
我想要将其转换为XSLT(版本3.0),只返回一个值,如下所示。逻辑是星期五 - 2023-03-10,星期二 - 2023-03-14。相差4个日历日。但是,我想要收到值2(不包括周六和周日)“工作日”。
能否协助使用XPath?我的意思是我想在模板中的某处使用XPath,以仅计算工作日之间的差异(/trade/exerciseDate/adjustedDate - 第1天和/trade/cashPaymentDate/adjustedDate - 第2天)。
我的目标是创建一个模板,只能使用XPath逻辑来计算我所展示的工作日期。
I've translated your text, keeping the code parts as requested. If you have any further questions or need assistance with XPath, feel free to ask.
英文:
I have this code.
<trade>
<exerciseDate>
<adjustedDate>2023-03-10</adjustedDate>
</exerciseDate>
<cashPaymentDate>
<adjustedDate>2023-03-14</adjustedDate>
</cashPaymentDate>
<currency>EUR</currency>
<effectiveDate>
<adjustedDate>2023-03-14</adjustedDate>
<dateAdjustments>
<businessDayConvention>NONE</businessDayConvention>
</dateAdjustments>
</effectiveDate>
<terminationDate>
<unadjustedDate>2024-03-14</unadjustedDate>
<dateAdjustments>
<businessDayConvention>MODFOLLOWING</businessDayConvention>
</dateAdjustments>
</terminationDate>
</trade>
I would like to receive as XSLT (ver.3.0) only 1 value. Like below. The logic is Friday - 2023-03-10,
Tuesday -2023-03-14. Difference 4 Calendar Days. But I would like to receive value 2 ( that excluding Saturday and Sunday ) 'Business Days'
<workingDate>2</workingDate>
Can you please assist with using XPath's? I mean I want to use there XPath somewhere in template, that can calculate difference only in Business Days(/trade/exerciseDate/adjustedDate - 1st day and
/trade/cashPaymentDate/adjustedDate - 2nd day )
My goal is to create a template where I can only calculate the working dates that I have shown but using Xpath logic
答案1
得分: 1
你应该能够使用以下表达式:
my:workdays-in-range(/trade/exerciseDate/adjustedDate, trade/cashPaymentDate/adjustedDate )
在定义了如你之前的问题中所示的必要函数之后。
英文:
You should be able to use the expression:
my:workdays-in-range(/trade/exerciseDate/adjustedDate, trade/cashPaymentDate/adjustedDate )
after defining the necessary functions as shown in your previous question.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论