Reputation: 1
I am trying to execute the below code but ended up in the below exception.
javax.xml.transform.TransformerConfigurationException: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
Code is:
<xsl:when test="/result/DECODE='CANCELLED'">
<xsl:variable name="match_dates" >
<xsl:for-each select="/legacyresult/*[starts-with(name(), 'END-DT')]">
<xsl:sort data-type="number"
select="concat(substring(.,7, 4),substring(.,4, 2),substring(.,1, 2))" order="descending" />
<xsl:variable name="end_dt" select="." />
<xsl:variable name="match" select="count(/legacyresult/*[starts-with(name(), 'EFF-DT')][text()=$end_dt])" />
<xsl:if test="$match=0" >
<xsl:value-of select="name(.)" />
<xsl:text >,</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="final_date" >
<xsl:value-of select="substring-before($match_dates, ',')" />
<xsl:for-each select="/legacyresult/*[starts-with(name(), 'END-DT')][.=$final_date]">
<xsl:sort select="substring(name(),13,2)" data-type="number"/>
<xsl:variable name="prodSeq" select="substring(name(),13,2)"/>
<xsl:variable name="id" select="position()"/>
<xsl:variable name="id">ID<xsl:value-of select="$sq"/>
</xsl:variable>
<xsl:element name="product">
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
<xsl:attribute name="productId">0<xsl:value-of select="/legacyresult/*[name() = $id]/."/></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:variable>
</xsl:when>
Please let me know what is wrong in the above code. I have cross checked the tags. But i unable to find the issue.
Upvotes: 0
Views: 540
Reputation: 2669
As far as I can see, you have the following error:
<xsl:variable name="id">ID<xsl:value-of select="$sq"/>
</xsl:variable>
The first line has a /
at the end, making it omni, but you're also closing a variable tag that doesn't start anywhere. Either remove the closing tag or the trailing /
of the first line.
Upvotes: 1