edi 856 hl sequence generation
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" />
<!-- Match the root element and apply templates to its child elements -->
<xsl:template match="/">
<M_856>
<xsl:apply-templates select="M_856/*" />
</M_856>
</xsl:template>
<!-- Match G_HL elements where S_HL/D_735 = 'I' -->
<xsl:template match="S_ST">
<xsl:copy-of select="." />
</xsl:template> <xsl:template match="S_BSN">
<xsl:copy-of select="." />
</xsl:template> <xsl:template match="S_DTM">
<xsl:copy-of select="." /> </xsl:template>
<xsl:template match="G_HL[S_HL/D_735='S']">
<xsl:copy-of select="." /> </xsl:template>
<xsl:template match="G_HL[S_HL/D_735='O']"> <xsl:copy-of select="." />
</xsl:template>
<xsl:template match="G_HL[S_HL/D_735='I']"> <xsl:copy-of select="." />
<xsl:for-each
select="../G_HL[S_HL/D_735='P' and S_LIN/D_350 = current()/S_LIN/D_350]">
<xsl:copy-of select="." />
</xsl:for-each>
</xsl:template>
<xsl:template match="S_CTT">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="S_SE">
<xsl:copy-of select="." />
</xsl:template>
<xsl:template match="text()">
</xsl:template>
</xsl:stylesheet>
--------------------
def void custFunc1(String[] Input, Output output, MappingContext context) {
int c1 = 0;
for (int i = 0; i < Input.size(); i++) {
if (Input[i] != null && Input[i].trim().length() > 0 && (Input[i].equals("I") || Input[i].equals("S") || Input[i].equals("O") ) ) {
c1++;
output.addValue(c1);
} else {
output.addValue(c1);
}
}
}
-----------------