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

Here should go questions about transforming XML with XSLT and FOP.
srinivas.chintu85
Posts: 1

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

Thu Jul 03, 2014 4:05 pm

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

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest