-3
這看起來像是一個重複的問題,但它不是(我已經搜索過所有的SO,無法找到答案)。屬性保持長度值相同的XSLT增量值
所以我有一個XSLT需要轉換成XML,基本上有一個屬性,其中的值必須增加,但是我們已經給出了一個設置格式的值,其中最後一部分遞增,但長度該值不能超過18個字符,繼承人什麼,我有一個工作例如:
XSLT:
<xsl:for-each select="Transactions/Transaction">
<Interaction
SourceCode="SRC12799"
ExternalID="ERHYDM000000000{position()}">
</Interaction>
</xsl:for-each>
OUTPUT:
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000001">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000002">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000003">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000004">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000005">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000006">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000007">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000008">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000009">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM00000000010"> <!-- Issue with length -->
所需的輸出(外部ID的長度應保持不變):
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000001">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000002">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000003">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000004">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000005">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000006">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000007">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000008">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000009">
<Interaction SourceCode="SRC12799" ExternalID="ERHYDM0000000010"> <!-- This is the corrected part (Same will happen for 100s 10000s and so on) -->
如何保留值的長度不變,而增加的價值?
所需的邏輯不完全清楚。你已經有15個字符;一旦你達到999,必須丟棄一些東西。 –