<?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 | STREET | CITY | STATE | ZIP | EMAIL"/>
	</CONTACT_PERSON>
	</HEADER>
	</xsl:for-each>
		<RECORDS>
		<xsl:for-each select="HC_DATA/RECORDS">
		<RECORD id="{RECORD_ID}">
		<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/RECORDS)"/>
		<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="247" y="72"/><block path="HC_DATA/RECORDS/xsl:for&#x2D;each" x="287" y="95"/></template></MapperBlockPosition></MapperMetaTag>
</metaInformation>
-->