<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" encoding="US-ASCII" indent="yes"/>

	<xsl:template match="/">
		<root>
			<xsl:apply-templates select="root/Filhdr"/>

			<xsl:for-each select="root/Invhdr">
				<invoice>
					<xsl:apply-templates select="."/>
					<xsl:for-each select="following-sibling::*[generate-id(preceding-sibling::Invhdr[1])=generate-id(current())]">
						<xsl:apply-templates select="."/>
					</xsl:for-each>
				</invoice>
			</xsl:for-each>

			<xsl:apply-templates select="root/Filtlr"/>
		</root>
	</xsl:template>
	<xsl:template match="Filhdr">
		<file_header>
			<rec_type>
				<xsl:value-of select="rec_type"/>
			</rec_type>
			<timestamp>
				<xsl:value-of select="timestamp"/>
			</timestamp>
		</file_header>
	</xsl:template>
	<xsl:template match="Invhdr">
		<invoice_header>
			<xsl:apply-templates select="field"/>
		</invoice_header>
	</xsl:template>
	<xsl:template match="Invlin">
		<invoice_line>
			<xsl:apply-templates select="field"/>
		</invoice_line>
	</xsl:template>
	<xsl:template match="Invtlr">
		<invoice_trailer>
			<xsl:apply-templates select="field"/>
		</invoice_trailer>
	</xsl:template>
	<xsl:template match="Filtlr">
		<file_trailer>
			<xsl:apply-templates select="field"/>
		</file_trailer>
	</xsl:template>

	<!-- this is just temporary code to dump the fields of each record -->
	<xsl:template match="field">
		<field>
			<xsl:value-of select="."/>
		</field>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="adapter:test_lilly002.conv?file:///c:/bug/bex_lilly_invoice_data.txt" htmlbaseurl="" outputurl="" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="adapter:test_lilly002.conv?file:///c:/bug/bex_lilly_invoice_data.txt" srcSchemaRoot="root" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/"></template><template match="Filtlr"></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->
