<?xml version="1.0" encoding="UTF-8"?>
<!--.................................................................................................................................
         (c) 2004 Basler Vision Technologies
		 Section: Vision Components
		 Project: GenApi
		 $Header: /cvs/genicam/genicam/xml/GenApi/BigEndianConv.xsl,v 1.2 2006/02/22 11:49:05 rueder Exp $
		 Author: Hartmut Nebelung
		 
		 Convert nested xml register spec with old big endian number scheme into reverse one. 
         .................................................................................................................................-->
<xsl:stylesheet version="1.0" xmlns:gen="http://www.genicam.org/GenApi/Version_1_0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
	<xsl:template match="gen:Bit | gen:LSB | gen:MSB">
		<xsl:choose>
			<xsl:when test="../gen:Endianess = 'BigEndian' or ../../gen:Endianess = 'BigEndian'">
				<xsl:copy>
					<xsl:value-of select="31- ."/>
				</xsl:copy>
			</xsl:when>
			<xsl:otherwise>
				<xsl:copy-of select="."/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<!--Copy any other attribute or element which are not matched by the above rules.-->
	<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
	<xsl:template match="@*|node()">
		<xsl:copy>
			<xsl:apply-templates select="@*|node()"/>
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>
