<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<!--
DTD for converting a nested XML collection of Business Information 
to a RuleML collection 

This XSLT Created in 2003  by Marcel Ball
 National Research Council of Canada, 
 updated by Anna Maclachlan February 2004
 updated by Marcel Ball May 2004.

Designed for use with data converted by: biznetflat2nestedent.xslt
which works over data from the Government of New Brunswick, Canada: 
The 2002 Biznet Directory of Manufacturers and Selected Services to Industry 
  available at http://biznet.gnb.ca/ManuDirectory/
-->

	<xsl:template match="BIZNET_ENTS">
		<rulebase>
			<xsl:apply-templates select="BIZNET_ENT"/>
		</rulebase>
	</xsl:template>

	<xsl:template match="BIZNET_ENT">
		<fact>
			<_head>
				<atom>
					<_opr><rel>BIZNET_ENT</rel></_opr>
					<xsl:apply-templates/>
				</atom>
			</_head>
		</fact>

	</xsl:template>

	<xsl:template match="CONTACT">
		<_slot name="CONTACT">
			<plex>
				<xsl:apply-templates/>
			</plex>
		</_slot>
	</xsl:template>

	<xsl:template match="CONTACT_PERSON">
		<_slot name="CONTACT_PERSON">
			<plex>
				<xsl:apply-templates/>
			</plex>
		</_slot>
	</xsl:template>

	<xsl:template match="MAILING_ADDRESS">
		<_slot name="MAILING_ADDRESS">
			<plex>
				<xsl:apply-templates/>
			</plex>
		</_slot>
	</xsl:template>

	<xsl:template match="PLANT_ADDRESS">
		<_slot name="PLANT_ADDRESS">
			<plex>
				<xsl:apply-templates/>
			</plex>
		</_slot>
	</xsl:template>

	<xsl:template match="CURRENT_EMPLOYMENT">
		<_slot name="CURRENT_EMPLOYMENT">
			<plex>
				<xsl:apply-templates/>
			</plex>
		</_slot>
	</xsl:template>

	<xsl:template match="PHONE">
		      <xsl:element name="_slot">
				   <xsl:attribute name="name">PHONE</xsl:attribute>
				   <ind>(506) <xsl:value-of select="."/></ind>
		      </xsl:element>
	</xsl:template>

	<xsl:template match="@*|node()">
		<xsl:if test="name(.) != ''">
		<xsl:element name="_slot">
			<xsl:attribute name="name">
				<xsl:value-of select="name(.)"/>
			</xsl:attribute>
			<ind><xsl:value-of select="."/></ind>
		</xsl:element>
		</xsl:if>
	</xsl:template>

</xsl:stylesheet>
