I am not sure why I receive the following error in my XSLT:
Axis step child::element(_SetMax42, xs:anyType) cannot be used here: the context item is an atomic value
It seems like using count on the xsl:when
condition seems to cause it, but I don't understand why or how to resolve this to get what I need.
<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]"/>