问题: 从XML的PLAN_ENROLLED_INFO级别开始,嵌套的for-each不起作用,从XML的PLAN_ENROLLED_INFO级别开始, XML元素正在复制,而不是循环中的新值。 从IO_DEVICE_INFO_ITEM级别开始,XML元素开始循环,但是与内循环元素一起重复
XML:
<IO_DEVICE_INFO_ITEM>
<ESN>260730008835603</ESN>
<CARRIER_NAME>ATT</CARRIER_NAME>
<SERVICE_END_DATE>2020-10-10T00:00:00.000-04:00</SERVICE_END_DATE>
<PLAN_ENROLLED_INFO>
<PLAN_ENROLLED_INFO_ITEM>
<PLANID>5803843</PLANID>
<PLAN_NAME>CES Data Club Annual Service - B2B</PLAN_NAME>
<PLAN_DESCRIPTION>CES $50 Data Club Annual - AUTO REFILL</PLAN_DESCRIPTION>
<PLAN_TYPE>DATA_CLUB</PLAN_TYPE>
</PLAN_ENROLLED_INFO_ITEM>
<PLAN_ENROLLED_INFO_ITEM>
<PLANID>5803842</PLANID>
<PLAN_NAME>CES Data Club LowBalance 1GB - B2B</PLAN_NAME>
<PLAN_DESCRIPTION>CES $10 Data Club Low Balance</PLAN_DESCRIPTION>
<PLAN_TYPE>DATA_CLUB_LOWBALANCE</PLAN_TYPE>
<AUTO_REFILL_MAX_LIMIT>999</AUTO_REFILL_MAX_LIMIT>
</PLAN_ENROLLED_INFO_ITEM>
</PLAN_ENROLLED_INFO>
</IO_DEVICE_INFO_ITEM>
<IO_DEVICE_INFO_ITEM>
<ESN>260730008789875</ESN>
<SERVICE_END_DATE>2019-11-08T00:00:00.000-05:00</SERVICE_END_DATE>
<PLAN_ENROLLED_INFO>
<PLAN_ENROLLED_INFO_ITEM>
<PLANID>5804297</PLANID>
<PLAN_NAME>UNLIMITED 20 GB ILD 30-DAY PLAN CES- B2B</PLAN_NAME>
<PLAN_DESCRIPTION> Unlimited Talk, Text and Data (20 GB Data @ 4G speed) + ILD /30 Days AUTO REFILL</PLAN_DESCRIPTION>
<PLAN_TYPE>BASE_PLAN</PLAN_TYPE>
<NEXT_CHARGE_DATE>2019-11-08T12:06:08.000-05:00</NEXT_CHARGE_DATE>
</PLAN_ENROLLED_INFO_ITEM>
<PLAN_ENROLLED_INFO_ITEM>
<PLANID>5804312</PLANID>
<PLAN_NAME> $10 ILD B2B</PLAN_NAME>
<PLAN_DESCRIPTION> $10 ILD - Auto Refill on Low Balance</PLAN_DESCRIPTION>
<PLAN_TYPE>ILD</PLAN_TYPE>
<BANK_ACCNT_NO xsi:nil="true"/>
</PLAN_ENROLLED_INFO_ITEM>
</PLAN_ENROLLED_INFO>
</IO_DEVICE_INFO_ITEM>
带有嵌套for-each的XSLT转换,在下面需要帮助
<xsl:for-each select="/ns0:OutputParameters/ns0:IO_DEVICE_INFO/ns0:IO_DEVICE_INFO_ITEM">
<tns:accountDevice>
<tns:esn>
<xsl:value-of select="ns0:ESN"/>
</tns:esn>
<tns:enrollments>
<xsl:for-each select="ns0:PLAN_ENROLLED_INFO/ns0:PLAN_ENROLLED_INFO_ITEM">
<tns:enrollment>
<tns:enrolledPlanId>
<xsl:value-of select="/ns0:OutputParameters/ns0:IO_DEVICE_INFO/ns0:IO_DEVICE_INFO_ITEM/ns0:PLAN_ENROLLED_INFO/ns0:PLAN_ENROLLED_INFO_ITEM/ns0:PLANID"/>
</tns:enrolledPlanId>
<tns:type>AUTO_REFILL</tns:type>
<tns:name>DATA_LOW_BALANCE</tns:name>
<tns:characteristics>
<tns:characteristic>
<tns:name>PLAN_NAME</tns:name>
<tns:value>
<xsl:value-of select="/ns0:OutputParameters/ns0:IO_DEVICE_INFO/ns0:IO_DEVICE_INFO_ITEM/ns0:PLAN_ENROLLED_INFO/ns0:PLAN_ENROLLED_INFO_ITEM/ns0:PLAN_NAME"/>
</tns:value>
</tns:characteristics>
</tns:enrollment>
</xsl:for-each>
</tns:enrollments>
</tns:accountDevice>
</xsl:for-each>