<?xml version="1.0" encoding="UTF-8"?>
<!-- 
FDT: device identification transformation for Interbus device identification xml files
-->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://xsltsl.org/string" xmlns:ident="x-schema:DTMIdentSchema.xml" xmlns:fdt="x-schema:FDTDataTypesSchema.xml" xmlns:scanident="x-schema:DTMScanIdentSchema.xml" xmlns:devident="x-schema:DTMDeviceTypeIdentSchema.xml" xmlns:ibsident="x-schema:FDTInterbusIdentSchema.xml" xmlns:ibsdevice="x-schema:FDTInterbusDeviceTypeIdentSchema.xml" xmlns:ibsscan="x-schema:FDTInterbusScanIdentSchema.xml" version="2.0">
	<!-- 
FDT: version of this file
	-->
	<xsl:variable name="FileVersion">
		<xsl:number value="1.21"/>
	</xsl:variable>
	<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
	<!-- 
root: transform device or scan identification
-->
	<xsl:template match="/">
		<xsl:apply-templates select="//ibsscan:ScanIdentifications"/>
		<xsl:apply-templates select="//ibsdevice:DeviceIdentifications"/>
	</xsl:template>
	<!-- 
INTERBUS identification list
-->
	<xsl:template match="ibsdevice:DeviceIdentifications">
		<xsl:text disable-output-escaping="yes">&lt;?xml version="1.0"?&gt;
	&lt;!-- This file is created by FDTInterbusIdentTransformation.xsl after transformation of InterbusDTMDeviceIdentificationInstance.xml --&gt;
	&lt;FDT xmlns="x-schema:DTMDeviceTypeIdentSchema.xml" 
	 xmlns:ident="x-schema:DTMIdentSchema.xml" xmlns:fdt="x-schema:FDTDataTypesSchema.xml" &gt;</xsl:text>
		<xsl:element name="DeviceIdentifications">
			<xsl:apply-templates select="ibsdevice:DeviceIdentification_IBS"/>
			<xsl:apply-templates select="ibsdevice:DeviceIdentification_IBS_PCP"/>
			<xsl:apply-templates select="ibsdevice:DeviceIdentification_IBS_BASE_PROFILE"/>
		</xsl:element>
		<xsl:text disable-output-escaping="yes">&lt;/FDT&gt;</xsl:text>
	</xsl:template>
	<!-- 
INTERBUS catalog identifcation
-->
	<xsl:template match="ibsdevice:DeviceIdentification_IBS">
		<xsl:element name="DeviceIdentification">
			<xsl:attribute name="ident:idDTMSupportLevel"><xsl:value-of select="@ibsident:idDTMSupportLevel"/></xsl:attribute>
			<xsl:element name="IdBusProtocol">
				<xsl:attribute name="ident:protocolSpecificName">INTERBUS</xsl:attribute>
				<xsl:attribute name="ident:value"><xsl:value-of select="ibsdevice:IdBusProtocol/@ibsident:busProtocol"/></xsl:attribute>
			</xsl:element>
			<xsl:element name="IdBusProtocolVersion">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdManufacturer">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:apply-templates select="ibsdevice:TypeIDIBS"/>
			<xsl:element name="IdSoftwareRevision">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdHardwareRevision">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	<!-- 
Interbus scan identifcation
-->
	<xsl:template match="ibsscan:ScanIdentification_IBS">
		<xsl:element name="ScanIdentification">
			<xsl:apply-templates select="@configuredState"/>
			<xsl:apply-templates select="fdt:CommunicationError"/>
			<xsl:element name="IdBusProtocol">
				<xsl:attribute name="ident:protocolSpecificName">INTERBUS</xsl:attribute>
				<xsl:attribute name="ident:value"><xsl:value-of select="ibsscan:IdBusProtocol/@ibsident:busProtocol"/></xsl:attribute>
			</xsl:element>
			<xsl:apply-templates select="ibsscan:IdBusProtocol"/>
			<xsl:element name="IdBusProtocolVersion">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:apply-templates select="ibsscan:IdAddress"/>
			<xsl:element name="IdManufacturer">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:apply-templates select="ibsscan:TypeIDIBS"/>
			<xsl:element name="IdSoftwareRevision">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdHardwareRevision">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdDeviceTag">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdSerialNumber">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	<!-- 
Interbus PCP catalog identifcation
-->
	<xsl:template match="ibsdevice:DeviceIdentification_IBS_PCP">
		<xsl:element name="DeviceIdentification">
			<xsl:attribute name="ident:idDTMSupportLevel"><xsl:value-of select="@ibsident:idDTMSupportLevel"/></xsl:attribute>
			<xsl:element name="IdBusProtocol">
				<xsl:attribute name="ident:protocolSpecificName">INTERBUS PCP</xsl:attribute>
				<xsl:attribute name="ident:value"><xsl:value-of select="ibsdevice:IdBusProtocol/@ibsident:busProtocol"/></xsl:attribute>
			</xsl:element>
			<xsl:element name="IdBusProtocolVersion">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:apply-templates select="ibsdevice:IdManufacturer"/>
                        <xsl:apply-templates select="ibsdevice:IdTypeID"/>
			<xsl:apply-templates select="ibsdevice:IdSoftwareRevision"/>
			<xsl:element name="IdHardwareRevision">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdValues">
                           <xsl:apply-templates select="ibsdevice:IdentCode"/>
                           <xsl:apply-templates select="ibsdevice:ProcessLength"/>
                           <xsl:apply-templates select="ibsdevice:ParamLength"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	<!-- 
Interbus PCP scan identifcation
-->
	<xsl:template match="ibsscan:ScanIdentification_IBS_PCP">
		<xsl:element name="ScanIdentification">
			<xsl:apply-templates select="@configuredState"/>
			<xsl:apply-templates select="fdt:CommunicationError"/>
			<xsl:element name="IdBusProtocol">
				<xsl:attribute name="ident:protocolSpecificName">INTERBUS PCP</xsl:attribute>
				<xsl:attribute name="ident:value"><xsl:value-of select="ibsscan:IdBusProtocol/@ibsident:busProtocol"/></xsl:attribute>
			</xsl:element>
			<xsl:element name="IdBusProtocolVersion">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:apply-templates select="ibsscan:IdAddress"/>
			<xsl:apply-templates select="ibsscan:IdManufacturer"/>
                        <xsl:apply-templates select="ibsscan:IdTypeID"/>
			<xsl:apply-templates select="ibsscan:IdSoftwareRevision"/>
			<xsl:element name="IdHardwareRevision">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdDeviceTag">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdSerialNumber">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdValues">
				<xsl:apply-templates select="ibsscan:IdentCode"/>
                           <xsl:apply-templates select="ibsscan:ProcessLength"/>
                           <xsl:apply-templates select="ibsscan:ParamLength"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
<!-- 
IBS Base Profile catalog identifcation
-->
	<xsl:template match="ibsdevice:DeviceIdentification_IBS_BASE_PROFILE">
		<xsl:element name="DeviceIdentification">
			<xsl:attribute name="ident:idDTMSupportLevel"><xsl:value-of select="@ibsident:idDTMSupportLevel"/></xsl:attribute>
			<xsl:element name="IdBusProtocol">
				<xsl:attribute name="ident:protocolSpecificName">Profile</xsl:attribute>
				<xsl:attribute name="ident:value"><xsl:value-of select="ibsdevice:IdBusProtocol/@ibsident:busProtocol"/></xsl:attribute>
			</xsl:element>
			<xsl:element name="IdBusProtocolVersion">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
                        <xsl:apply-templates select="ibsdevice:IdManufacturer"/>
                        <xsl:apply-templates select="ibsdevice:IdTypeID"/>
			<xsl:apply-templates select="ibsdevice:IdSoftwareRevision"/>
			<xsl:apply-templates select="ibsdevice:IdHardwareRevision"/>
			<xsl:element name="IdValues">
                           <xsl:apply-templates select="ibsdevice:IdentCode"/>
                           <xsl:apply-templates select="ibsdevice:ProcessLength"/>
                           <xsl:apply-templates select="ibsdevice:ParamLength"/>
				<xsl:apply-templates select="ibsdevice:OrderId"/>
				<xsl:apply-templates select="ibsdevice:VendorId"/>
				<xsl:apply-templates select="ibsdevice:DeviceFamily"/>
				<xsl:apply-templates select="ibsdevice:PCPVersion"/>
				<xsl:apply-templates select="ibsdevice:CommProfile"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
<!-- 
IBS Base Profile  scan identifcation
-->
	<xsl:template match="ibsscan:ScanIdentification_IBS_BASE_PROFILE">
		<xsl:element name="ScanIdentification">
			<xsl:apply-templates select="@configuredState"/>
			<xsl:apply-templates select="fdt:CommunicationError"/>
			<xsl:element name="IdBusProtocol">
				<xsl:attribute name="ident:protocolSpecificName">Profile</xsl:attribute>
				<xsl:attribute name="ident:value"><xsl:value-of select="ibsscan:IdBusProtocol/@ibsident:busProtocol"/></xsl:attribute>
			</xsl:element>
			<xsl:element name="IdBusProtocolVersion">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>                        
			<xsl:apply-templates select="ibsscan:IdAddress"/>
                        <xsl:apply-templates select="ibsscan:IdManufacturer"/>
                        <xsl:apply-templates select="ibsscan:IdTypeID"/>
			<xsl:apply-templates select="ibsscan:IdSoftwareRevision"/>
			<xsl:apply-templates select="ibsscan:IdHardwareRevision"/>
			<xsl:element name="IdDeviceTag">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdSerialNumber">
				<xsl:attribute name="ident:protocolSpecificName">not applicable</xsl:attribute>
			</xsl:element>
			<xsl:element name="IdValues">
				<xsl:apply-templates select="ibsscan:IdentCode"/>
                           <xsl:apply-templates select="ibsscan:ProcessLength"/>
                           <xsl:apply-templates select="ibsscan:ParamLength"/>
				<xsl:apply-templates select="ibsscan:OrderId"/>
				<xsl:apply-templates select="ibsscan:VendorId"/>
				<xsl:apply-templates select="ibsscan:DeviceFamily"/>
				<xsl:apply-templates select="ibsscan:PCPVersion"/>
				<xsl:apply-templates select="ibsscan:CommProfile"/>
			</xsl:element>
		</xsl:element>
	</xsl:template>
	<!-- 
scan list
-->
	<xsl:template match="ibsscan:ScanIdentifications">
		<xsl:text disable-output-escaping="yes">&lt;?xml version="1.0"?&gt;
	&lt;!-- This file is created by FDTInterbusIdentTransformation.xsl after transformation of InterbusDTMScanIdentificationInstance.xml --&gt;&lt;FDT xmlns="x-schema:DTMScanIdentSchema.xml" 
	 xmlns:ident="x-schema:DTMIdentSchema.xml" xmlns:fdt="x-schema:FDTDataTypesSchema.xml" &gt;</xsl:text>
		<xsl:element name="ScanIdentifications">
			<xsl:attribute name="fdt:busCategory"><xsl:value-of select="@fdt:busCategory"/></xsl:attribute>
			<xsl:attribute name="resultState"><xsl:value-of select="@resultState"/></xsl:attribute>
			<xsl:apply-templates select="ibsscan:ScanIdentification_IBS"/>
			<xsl:apply-templates select="ibsscan:ScanIdentification_IBS_PCP"/>
			<xsl:apply-templates select="ibsscan:ScanIdentification_IBS_BASE_PROFILE"/>
		</xsl:element>
		<xsl:text disable-output-escaping="yes">&lt;/FDT&gt;</xsl:text>
	</xsl:template>
	<!-- 
configured attribute
-->
	<xsl:template match="@configuredState">
		<xsl:attribute name="configuredState"><xsl:value-of select="."/></xsl:attribute>
	</xsl:template>
	<!-- 
device tag
-->
	<xsl:template match="ibsscan:IdTag">
		<xsl:element name="IdDeviceTag">
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:deviceTAG"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">DeviceTag</xsl:attribute>
		</xsl:element>
	</xsl:template>
	<!-- 
communicationError
-->
	<xsl:template match="fdt:CommunicationError">
		<xsl:element name="fdt:CommunicationError">
			<xsl:attribute name="communicationError"><xsl:value-of select="@communicationError"/></xsl:attribute>
			<xsl:attribute name="tag"><xsl:value-of select="@tag"/></xsl:attribute>
		</xsl:element>
	</xsl:template>
	<!-- 
serialnumber
-->
	<xsl:template match="ibsscan:IdSerialNumber">
		<xsl:element name="IdSerialNumber">
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:serialNumber"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">SerialNumber</xsl:attribute>
		</xsl:element>
	</xsl:template>
	<!-- 
busaddress
-->
	<xsl:template match="ibsscan:IdAddress">
		<xsl:element name="IdAddress">
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:systemNumber"/>.<xsl:value-of select="@ibsident:segmentNumber"/>.<xsl:value-of select="@ibsident:positionNumber"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">Logical Device Number</xsl:attribute>
		</xsl:element>
	</xsl:template>
<!-- 
    Order Number
-->
	<xsl:template match="ibsdevice:OrderId">
		<xsl:param name="value" select="@ibsident:orderId"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">OrderNumber</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">OrderNumber</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:OrderId">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">OrderNumber</xsl:attribute>
			<xsl:attribute name="ident:name">OrderNumber</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:orderId"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
    Vendor_Id
-->
	<xsl:template match="ibsdevice:VendorId">
		<xsl:param name="value" select="@ibsident:vendorId"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">VendorID</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">VendorID</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:VendorId">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">VendorID</xsl:attribute>
			<xsl:attribute name="ident:name">VendorID</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:vendorId"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
    Device_Family
-->
	<xsl:template match="ibsdevice:DeviceFamily">
		<xsl:param name="value" select="@ibsident:deviceFamily"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">DeviceFamily</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">DeviceFamily</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:DeviceFamily">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">DeviceFamily</xsl:attribute>
			<xsl:attribute name="ident:name">DeviceFamily</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:deviceFamily"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
   PCP_Version
-->
	<xsl:template match="ibsdevice:PCPVersion">
		<xsl:param name="value" select="@ibsident:pcpVersion"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">PCPVersion</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">PCPVersion</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:PCPVersion">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">PCPVersion</xsl:attribute>
			<xsl:attribute name="ident:name">PCPVersion</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:pcpVersion"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
   Comm_Profile
-->
	<xsl:template match="ibsdevice:CommProfile">
		<xsl:param name="value" select="@ibsident:commProfile"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">CommProfile</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">CommProfile</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:CommProfile">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">CommProfile</xsl:attribute>
			<xsl:attribute name="ident:name">CommProfile</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:commProfile"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
   Ident Code
-->
	<xsl:template match="ibsdevice:IdentCode">
		<xsl:param name="value" select="@ibsident:identCode"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">Ident Code</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">Ident Code</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:IdentCode">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Ident Code</xsl:attribute>
			<xsl:attribute name="ident:name">Ident Code</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:identCode"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
   Process Data Length
-->
	<xsl:template match="ibsdevice:ProcessLength">
		<xsl:param name="value" select="@ibsident:PDLength"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">Process Data Length</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">Process Data Length</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:ProcessLength">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Process Data Length</xsl:attribute>
			<xsl:attribute name="ident:name">Process Data Length</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:PDLength"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
   Parameter Channel Length
-->
	<xsl:template match="ibsdevice:ParamLength">
		<xsl:param name="value" select="@ibsident:PALength"/>
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:name">Parameter Channel Length</xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">Parameter Channel Length</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:ParamLength">
		<xsl:element name="IdValue">
			<xsl:attribute name="ident:protocolSpecificName">Parameter Channel Length</xsl:attribute>
			<xsl:attribute name="ident:name">Parameter Channel Length</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:PALength"/></xsl:attribute>
		</xsl:element>
	</xsl:template>



<!-- 
    Manufacturer Name
-->
	<xsl:template match="ibsdevice:IdManufacturer">
		<xsl:param name="manid" select="@ibsident:manufacturerName"/>
		<xsl:element name="IdManufacturer">
			<xsl:attribute name="ident:protocolSpecificName">VendorName</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$manid"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:IdManufacturer">
		<xsl:element name="IdManufacturer">
			<xsl:attribute name="ident:protocolSpecificName">VendorName</xsl:attribute>
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:manufacturerName"/></xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
    device type for Simple Interbus Devices
-->
	<xsl:template match="ibsdevice:TypeIDIBS">
		<xsl:param name="value1" select="@ibsident:identCode"/>
		<xsl:param name="value2" select="@ibsident:PDLength"/>
		<xsl:param name="value3" select="@ibsident:PALength"/>
		<xsl:element name="IdTypeID">
			<xsl:call-template name="genIbsMatch">
				<xsl:with-param name="value1" select="$value1"/>
				<xsl:with-param name="value2" select="$value2"/>
				<xsl:with-param name="value3" select="$value3"/>
			</xsl:call-template>
			<xsl:attribute name="ident:protocolSpecificName">Ident-Code/PDLength/PALength</xsl:attribute>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:TypeIDIBS">
		<xsl:element name="IdTypeID">
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:identCode"/>/<xsl:value-of select="@ibsident:PDLength"/>/<xsl:value-of select="@ibsident:PALength"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">Ident-Code/PDLength/PALength</xsl:attribute>
		</xsl:element>
	</xsl:template>

<!-- 
    device type for PCP and Base Profile Interbus Devices
-->
	<xsl:template match="ibsdevice:IdTypeID">
		<xsl:param name="value" select="@ibsident:deviceName"/>
		<xsl:element name="IdTypeID">
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
			<xsl:attribute name="ident:protocolSpecificName">ProductName</xsl:attribute>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:IdTypeID">
		<xsl:element name="IdTypeID">
			<xsl:attribute name="ident:value"><xsl:value-of select="@ibsident:deviceName"/></xsl:attribute>
			<xsl:attribute name="ident:protocolSpecificName">ProductName</xsl:attribute>
		</xsl:element>
	</xsl:template>


<!-- 
    software revision
-->
	<xsl:template match="ibsdevice:IdSoftwareRevision">
		<xsl:param name="value" select="@ibsident:firmwareRevision"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">FirmwareVersion</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:IdSoftwareRevision">
		<xsl:param name="value" select="@ibsident:firmwareRevision"/>
		<xsl:element name="IdSoftwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">FirmwareVersion</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>

<!-- 
    hardware revision
-->
	<xsl:template match="ibsdevice:IdHardwareRevision">
		<xsl:param name="value" select="@ibsident:hardwareRevision"/>
		<xsl:element name="IdHardwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">HardwareVersion</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>
	<xsl:template match="ibsscan:IdHardwareRevision">
		<xsl:param name="value" select="@ibsident:hardwareRevision"/>
		<xsl:element name="IdHardwareRevision">
			<xsl:attribute name="ident:protocolSpecificName">HardwareVersion</xsl:attribute>
			<xsl:call-template name="genMatch">
				<xsl:with-param name="value" select="$value"/>
			</xsl:call-template>
		</xsl:element>
	</xsl:template>

	<xsl:template name="genIbsMatch">
		<xsl:param name="value1"/>
		<xsl:param name="value2"/>
		<xsl:param name="value3"/>
		<xsl:param name="empty"/>
		<xsl:if test="$value1!=$empty or $value2!=$empty or $value3!=$empty">
			 <xsl:attribute name="ident:value"><xsl:value-of select="$value1"/>/<xsl:value-of select="$value2"/>/<xsl:value-of select="$value3"/></xsl:attribute>
		</xsl:if>
		<xsl:apply-templates select="ibsident:RegExpr"/>
	</xsl:template>
	<!-- 
generate matching information
-->
	<xsl:template name="genMatch">
		<xsl:param name="value"/>
		<xsl:param name="empty"/>
		<xsl:if test="$value!=$empty">
			<xsl:attribute name="ident:value"><xsl:value-of select="$value"/></xsl:attribute>
		</xsl:if>
		<xsl:apply-templates select="ibsident:RegExpr"/>
	</xsl:template>
	<!-- 
generate regular exressions
-->
	<xsl:template match="ibsident:RegExpr">
		<!-- copy pattern info -->
		<xsl:call-template name="genPattern">
			<xsl:with-param name="match" select="@match"/>
			<xsl:with-param name="nomatch" select="@nomatch"/>
		</xsl:call-template>
	</xsl:template>
	<!-- 
generate pattern information
-->
	<xsl:template name="genPattern">
		<xsl:param name="match"/>
		<xsl:param name="nomatch"/>
		<xsl:param name="empty"/>
		<xsl:choose>
			<xsl:when test="$match!=$empty">
				<xsl:element name="ident:RegExpr">
					<xsl:attribute name="match"><xsl:value-of select="$match"/></xsl:attribute>
					<xsl:if test="$nomatch!=$empty">
						<xsl:attribute name="nomatch"><xsl:value-of select="$nomatch"/></xsl:attribute>
					</xsl:if>
				</xsl:element>
			</xsl:when>
			<xsl:when test="$nomatch!=$empty">
				<xsl:element name="ident:RegExpr">
					<xsl:attribute name="nomatch"><xsl:value-of select="$nomatch"/></xsl:attribute>
					<xsl:if test="$match!=$empty">
						<xsl:attribute name="match"><xsl:value-of select="$match"/></xsl:attribute>
					</xsl:if>
				</xsl:element>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
</xsl:transform>
