Page 1 of 1

A sequence of more than one item is not allowed as the first

Posted: Thu Jul 03, 2014 4:05 pm
by srinivas.chintu85
Hi Guys,
I have an XML file with the below psudo code.

Code: Select all

<eehcf:PolicyUnit .......>
<eehcf:SubscriberInfo change="NEW">
<hcfd:MaintenanceInfo>
<hcfd:MaintenanceAction value="Add">
<ucf:Version name="submitted" value="030"/>
</hcfd:MaintenanceAction>
<hcfd:MaintenanceReason value="XN"/>
<hcfd:MaintenanceEffectiveDate value="2014-02-01"/>
</hcfd:MaintenanceInfo>
</eehcf:SubscriberInfo>
<eehcf:SubscriberInfo change="NEW">
<hcfd:MaintenanceInfo>
<hcfd:MaintenanceAction value="None">
<ucf:Version name="submitted" value="030"/>
</hcfd:MaintenanceAction>
<hcfd:MaintenanceReason value="XN"/>
<hcfd:MaintenanceEffectiveDate value="2014-04-01"/>
</hcfd:MaintenanceInfo>
</eehcf:SubscriberInfo>
</eehcf:PolicyUnit>

In my XSLT file for translating the input XML i have the below psudo code

Code: Select all

<xsl:for-each select="/eehcf:PolicyUnit/eehcf:SubscriberInfo">
<xsl:choose>
<!--For CHANGE policy uses the maintenance effective date if there is one at the coverage level node.-->
<xsl:when test="/eehcf:PolicyUnit/@change='CHANGED' and normalize-space(hcfd:MaintenanceInfo/hcfd:MaintenanceEffectiveDate/@value)">
<xsl:attribute name="effDate">
<xsl:value-of select="hcfd:MaintenanceInfo/hcfd:MaintenanceEffectiveDate/@value">
</xsl:value-of>
</xsl:attribute>
</xsl:when>
<!--This will be used for ADD policy transactions. For ADDs use the same date as the policy effective date.-->
<xsl:when test="/eehcf:PolicyUnit/@change='NEW' and (normalize-space(hcfd:EnrollmentInfo/hcfd:Coverage[1]/hcfd:EnrollmentDates/hcfd:BenefitDates/ucf:BeginDate/@value) or normalize-space(hcfd:EnrollmentInfo/hcfd:EnrollmentDates/hcfd:EligibilityDateRange/ucf:BeginDate/@value))">
<xsl:choose>
<xsl:when test="normalize-space(hcfd:EnrollmentInfo/hcfd:Coverage[1]/hcfd:EnrollmentDates/hcfd:BenefitDates/ucf:BeginDate/@value)">
<xsl:attribute name="effDate">
<xsl:value-of select="hcfd:EnrollmentInfo/hcfd:Coverage[1]/hcfd:EnrollmentDates/hcfd:BenefitDates/ucf:BeginDate/@value">
</xsl:value-of>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="effDate">
<xsl:value-of select="hcfd:EnrollmentInfo/hcfd:EnrollmentDates/hcfd:EligibilityDateRange/ucf:BeginDate/@value">
</xsl:value-of>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>

</xsl:for-each
The above XSLT code is resulting the below error bcz we have 2 subscriberinfo blocks 1st block has date 2014-02-01 and 2nd block has 2014-04-01

org.hphc.enrollment.policy.trax.exceptions.TraxException: thrown by <unknown>: message: org.hphc.enrollment.policy.trax.exceptions.TraxException: thrown by <unknown>:
message: Failed to convert to Member Canonical.: cause: net.sf.saxon.trans.XPathException: cause
message: A sequence of more than one item is not allowed as the first argument of normalize-space() ("2014-02-01", "2014-04-01") :
cause: org.hphc.enrollment.policy.trax.exceptions.TraxException: cause message: org.hphc.enrollment.policy.trax.exceptions.TraxException: thrown by <unknown>:
message: Failed to convert to Member Canonical.: cause: net.sf.saxon.trans.XPathException: cause
message: A sequence of more than one item is not allowed as the first argument of normalize-space() ("2014-02-01", "2014-04-01")

Your solution for this issue will be appreciated