我有一个场景,我会将一个参数传递给 XSLT,而 XSLT 又是一个 xml 元素。但它将作为转义字符发送(< for < ....)
我的要求是我在其中有各种子节点,我必须遍历它们并需要进行转换。请找到请求,参数。
请求.xml
<retrievePaymentMethodsRequest>
<!--Optional:-->
<retrievePaymentMethodsRequestTO>
<financialAccountID>3</financialAccountID>
<bankCountryCode>1</bankCountryCode>
<clientID>12345</clientID>
<!--Optional:-->
<device>003</device>
<excludedLifeIndicator>003</excludedLifeIndicator>
<financialAccountStatus>3</financialAccountStatus>
<kindCode>003</kindCode>
<notEndedIndicator>0</notEndedIndicator>
<!--Optional:-->
<requestMode>003</requestMode>
<stateCode>003</stateCode>
</retrievePaymentMethodsRequestTO>
</retrievePaymentMethodsRequest>
xslt 的参数:
<b xmlns:fs2="somescheama" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fga="anyvalue"> xmlns:fs2="any value" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="any location ">
<statusCode>0</statusCode>
<errorMessage>errorMessage</errorMessage>
<paymentMethodTypes>
<!-- NULL or any type code 01, 04 , 10 (sample not real) -->
<methodTypeCode>01</methodTypeCode>
<!-- Possible values methodTypeDisplayName
CREDIT_CARD,BANK_ACCOUNT,CASH,CHECK,CASH_EQUIVALENT
-->
<methodTypeDisplayName>CREDIT_CARD</methodTypeDisplayName>
<!-- valid dollar amount -->
<maximumAmountPaid>100.00</maximumAmountPaid>
</paymentMethodTypes>
<paymentFormInfo>
<!-- NULL or any type code 01, 04 , 10 (sample not real) -->
<paymentMethodTypeCode>01</paymentMethodTypeCode>
<!-- sample form id 1004854 , 1004874 , 1004889 , 1004875-->
<formId>1004885</formId>
<!-- Not exactly sure just an assumption -->
<formLanguageRefId>US</formLanguageRefId>
<!-- forn name : EFT_AUTHORIZATION -->
<formName>EFT_AUTHORIZATION</formName>
<roleActivity>
<agentActivity>
<inOfficeRulesForActivity>
<!-- for Agent : REVIEW_PRINT, ESIGN , UPLOAD
for customer : CHECKBOX -->
<customerActivity>REVIEW_PRINT</customerActivity>
<customerRole>PAYOR</customerRole>
</inOfficeRulesForActivity>
<outOfOfficeRulesForActivity>
<customerActivity>CHECKBOX</customerActivity>
<customerRole>PAYOR</customerRole>
</outOfOfficeRulesForActivity>
</agentActivity>
<commonActivity>
<roleCategory>ONLINE</roleCategory>
<roleForActivity>
<customerActivity>ESIGN</customerActivity>
<customerRole>PAYOR</customerRole>
</roleForActivity>
</commonActivity>
</roleActivity>
</paymentFormInfo>
<financialAccountOwnerActivity>
<canChange>true</canChange>
<!-- valid String -->
<searchOptions>searchOptions</searchOptions>
</financialAccountOwnerActivity>
<canChooseAgent>true</canChooseAgent>
</b>
问题:这里大多数复杂元素都是零或更多。我需要遍历所有元素。但是,如果我们有如上所示的参数,则很难。我们无法实现 for-each 或任何其他有效的 xpath 评估,因为在参数中我们有 xs:String 。有没有办法循环遍历 xsl:param (or)xsl:copy 中的每个元素(或)任何有效的 xpath 评估
任何帮助表示赞赏
谢谢埃雷什