<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" indent="yes"/>
	<xsl:template match="/">
		<HC_DATA>
			<xsl:for-each select="HC_DATA/HEADER">
				<HEADER>
					<xsl:copy-of select="TRANS_CODE | RPT_YEAR | RPT_QTR | DATA_TYPE | SUBMISSION_TYPE | PROC_DATE | AHCA_NUM | ORG_NAME"/>
					<CONTACT_PERSON>
						<xsl:copy-of select="NAME | PHONE | EMAIL | STREET | CITY | STATE | ZIP"/>
					</CONTACT_PERSON>
				</HEADER>
			</xsl:for-each>
			<RECORDS>
				<xsl:for-each select="HC_DATA/RECORD">
					<RECORD id="{RECORD_ID}">
							<xsl:copy-of select="AHCA_NUM | PATIENT_SSN | PATIENT_RACE | PATIENT_BIRTHDATE | PATIENT_SEX | PATIENT_ZIP | ADMIT_TYPE | ADMIT_SOURCE | ADMIT_DATE | DISCH_DATE | DISCH_STATUS | PRINC_PAYER_CODE | PRINC_DIAG_CODE"/>
						<OTHER_DIAG_CODE>
							<xsl:copy-of select="OTHER_CODE | PRESENT_AT_ADMIT"/>
						</OTHER_DIAG_CODE>
						<PRINC_PROC_CODE>
							<xsl:copy-of select="PROC_CODE | PROC_DATE"/>
						</PRINC_PROC_CODE>
						<OTHER_PROC_CODE>
							<xsl:copy-of select="PROC_CODE | PROC_DATE"/>
						</OTHER_PROC_CODE>
							<xsl:copy-of select="RECORD_ID/following-sibling::*"/>
					</RECORD>
				</xsl:for-each>
			</RECORDS>
			<TRAILER>
				<NUMBER_OF_RECORDS>
					<xsl:variable name="mask" select="''"/><!-- if you need padding use for example '0000000' -->
					<xsl:variable name="r-count" select="count(HC_DATA/RECORD)"/>
					<xsl:variable name="padding" select="substring($mask, 1, (string-length($mask) - string-length($r-count)) )"/>
					<xsl:value-of select="concat($padding,$r-count)"/>
				</NUMBER_OF_RECORDS>
			</TRAILER>
		</HC_DATA>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Beaches" userelativepaths="yes" externalpreview="no" url="XSLInput.xml" htmlbaseurl="" outputurl="Output.xml" processortype="internal" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="Output.xml" destSchemaRoot="HC_DATA" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="XSLInput.xml" srcSchemaRoot="HC_DATA" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="/"><block path="HC_DATA/xsl:for&#x2D;each" x="226" y="6"/><block path="HC_DATA/RECORDS/xsl:for&#x2D;each" x="167" y="16"/><block path="HC_DATA/TRAILER/NUMBER_OF_RECORDS/xsl:value&#x2D;of" x="236" y="241"/><block path="HC_DATA/RECORDS/xsl:for&#x2D;each/RECORD/OTHER_DIAG_CODE/xsl:for&#x2D;each" x="191" y="37"/><block path="HC_DATA/RECORDS/xsl:for&#x2D;each/RECORD/PRINC_PROC_CODE/xsl:for&#x2D;each" x="178" y="57"/><block path="HC_DATA/RECORDS/xsl:for&#x2D;each/RECORD/PRINC_PROC_CODE/xsl:for&#x2D;each[1]" x="170" y="80"/></template></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->