From 1716f2b9ceec394b8b9c74e4f1880c8acadbac9c Mon Sep 17 00:00:00 2001
From: "VKMTHD\\franzjosefkober" <franz.josef.kober@ivt.tugraz.at>
Date: Tue, 15 Feb 2022 13:33:53 +0100
Subject: [PATCH] added sort method for input engine modes and fuel types

---
 .../Resources/XSLT/SortInputData.xslt         | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/VectoCommon/VectoHashing/Resources/XSLT/SortInputData.xslt b/VectoCommon/VectoHashing/Resources/XSLT/SortInputData.xslt
index 2ea6908f99..6d786e97b6 100644
--- a/VectoCommon/VectoHashing/Resources/XSLT/SortInputData.xslt
+++ b/VectoCommon/VectoHashing/Resources/XSLT/SortInputData.xslt
@@ -184,8 +184,28 @@
 			</xsl:for-each>
 		</xsl:if>
 	</xsl:template>
+		
+	<xsl:template match="*[local-name()='Fuel' and @type]">
+		<xsl:element name="{local-name()}">
+		  <xsl:apply-templates select="@*"/>
+			<xsl:for-each select="*">
+				<xsl:sort data-type="text" select="@type" order="ascending"/>
+				<xsl:apply-templates select="."/>
+			</xsl:for-each>
+		</xsl:element>	
+	</xsl:template>
 
-
+ 	<xsl:template match="*[local-name()='Mode' and ./*[local-name() = 'Fuel']]">
+		<xsl:if test="count(preceding-sibling::*[local-name()='Mode']) > (count(//*[local-name()='Mode']) - 2)">
+			<xsl:for-each select="../*[local-name()='Mode']">
+				<xsl:sort data-type="number" select="count(./*[local-name() = 'Fuel'])" order="ascending"/>
+					<xsl:element name="{local-name()}">
+						<xsl:apply-templates select="@*|node()"/> 
+					</xsl:element>
+			</xsl:for-each>
+		</xsl:if>
+	</xsl:template> 
+	
 	
 	<!--
 
-- 
GitLab