cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping : XML to Fixed Length File

Former Member
0 Kudos

Hi,

I have to code a XSLT mapping which converts the XML into a Fixed Length File Format. I am getting the output but it has some garbage values (Some extra spaces in front of first record and also extra blank lines before the first record)

I am pasting my xsl sheet :

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" indent="yes" media-type="text/plain"/>

<xsl:template match="Employees">

<xsl:for-each select="Employee">

<xsl:value-of select="Name"/>

<xsl:value-of select="ID"/>

<xsl:value-of select="ADD"/>

<xsl:text>&#xA;</xsl:text>

</xsl:for-each>

</xsl:template>

My input XML file is as follows:

<?xml version="1.0"?>

<p1:Test02 xmlns:p1="http://www.infosys.com/xi/training/hyd/66289">

<Employees>

<Employee>

<Name>Anurag</Name>

<ID>1121</ID>

<ADD>Hyderabad</ADD>

</Employee>

<Employee>

<Name>Divya</Name>

<ID>1122</ID>

<ADD>Hyderabad</ADD>

</Employee>

<Employee>

<Name>Rasmi</Name>

<ID>1123</ID>

<ADD>Bangalore</ADD>

</Employee>

</Employees>

</p1:Test02>

And the output i am receiving is as follows:

Anurag1121Hyderabad

Divya1122Hyderabad

Rasmi1123Bangalore

Please do help.....

Accepted Solutions (0)

Answers (1)

Answers (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>>

<xsl:output method="text" indent="yes" media-type="text/plain"/>

you allow the spaces by using indent="yes"

try with indent="no"

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>