sorin wrote:Hello,
You did not specify how the fixed length output file depends on the (variable length ?) input XML file. What should the transformation do ? Without knowing more about this it is impossible to help you. Can you post small samples of the input XML file and the output file ?
Regards,
Sorin
Hi sorin,
you can try this out for transfrming a XML file to a fixed length file.
EX:if u want to convert EMP_NO= "12 " to make it to the length of 10.
ur output will be "0000000012".
Here is the code.
Use this template
<xsl:template name="append-pad-left">
<xsl:param name="padChar"> </xsl:param>
<xsl:param name="padVar"/>
<xsl:param name="length"/>
<xsl:choose>
<xsl:when test="string-length($padVar) < $length">
<xsl:call-template name="append-pad-left">
<xsl:with-param name="padChar" select="$padChar"/>
<xsl:with-param name="padVar" select="concat($padVar,$padChar)"/>
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring($padVar,1,$length)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
and call this template wherever u need.
<xsl:call-template name="append-pad-left">
<xsl:with-param name="padChar" select="' '"></xsl:with-param>
<xsl:with-param name="padVar" select="EMP_NO"></xsl:with-param>
<xsl:with-param name="length" select="10"/>
</xsl:call-template>
Thanks
Gaya