gpt4 book ai didi

xml - axis step child::element 不能在这里使用:上下文项是一个原子值

转载 作者:数据小太阳 更新时间:2023-10-29 02:34:11 29 4
gpt4 key购买 nike

我不确定为什么我会在我的 XSLT 中收到以下错误:

Axis step child::element(_SetMax42, xs:anyType) cannot be used here: the context item is an atomic value

似乎在 xsl:when 条件上使用 count 似乎会导致它,但我不明白为什么或如何解决这个问题以获得我需要的东西。

  <xsl:variable name='_LoopVar_102_0_set' select="$_ManageWorkOrderSubmitWorkOrderRequest/soapenv:Envelope[1]/soapenv:Body[1]/bons1:ManageWorkOrderSubmitWorkOrderRequest[1]/WorkOrder[1]/CustomerAccount[1]/ServiceAddress[1]/LineCardInfo[1]/Cable"/>
<xsl:variable name='_LoopVar_102_1_set' select="$_LoopVar_100_0/Cable"/>
<xsl:variable name='_SetMax42r'>
<xsl:choose>
<xsl:when test="count($_LoopVar_102_0_set) >= count($_LoopVar_102_1_set)">
<xsl:apply-templates select="$_LoopVar_102_0_set" mode='enumerate'/>
</xsl:when>
<xsl:when test="count($_LoopVar_102_1_set) >= count($_LoopVar_102_0_set)">
<xsl:apply-templates select="$_LoopVar_102_1_set" mode='enumerate'/>
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:variable name='_SetMax42' select="$_SetMax42r/*"/>
<xsl:variable name='count2'>
<xsl:choose>
<xsl:when test='count(_SetMax42) = 0'>
<xsl:value-of select="1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select='count(_SetMax42)'/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="1 to $count2">
<xsl:variable name="_index43" select='$count2'/>
<xsl:variable name='_LoopVar_102_0' select="$_LoopVar_102_0_set[position()=$_index43]"/>
<xsl:variable name='_LoopVar_102_1' select="$_LoopVar_102_1_set[position()=$_index43]"/>

最佳答案

代替

count(_SetMax42)

使用

count($_SetMax42)

...虽然您可能在其他地方有另一种类似的错误,因为仅此并不能完全解释您的错误消息。


更新:正如 Michael Kay 在评论中指出的那样,如果此时上下文项是原子值,则单独进行上述修复可能就足够了。如果没有 $_SetMax42 将被视为上下文项的子元素,如果上下文项 count() 将返回 0是一个节点,但如果它是一个原子值,则会失败并显示给定的错误消息。使用 $$_setMax42 将不依赖于上下文项,添加 $ 可能单独解决您的问题。

关于xml - axis step child::element 不能在这里使用:上下文项是一个原子值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35997674/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com