Try it this way?
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/Device">
<!-- HEADER -->
<xsl:text>Description, Class, HardwareID, Vendor, BIOSRelDate, BIOSVersion </xsl:text>
<!-- COMMON DATA -->
<xsl:variable name="common">
<xsl:value-of select="@Description"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="@Class"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="HardwareIDs/ID/@Value"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="Properties/Vendor/@Value"/>
<xsl:text>,</xsl:text>
</xsl:variable>
<!-- GENERATE ROWS -->
<xsl:for-each select="Properties/BIOSRelDate">
<!-- SORT BY YEAR -->
<xsl:sort select="substring(@Value, 7, 4)" data-type="number"/>
<!-- SORT BY MONTH -->
<xsl:sort select="substring(@Value, 1, 2)" data-type="number"/>
<!-- SORT BY DAY -->
<xsl:sort select="substring(@Value, 4, 2)" data-type="number"/>
<!-- OUTPUT -->
<xsl:value-of select="$common"/>
<xsl:value-of select="@Value"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="following-sibling::BIOSVersion[1]/@Value"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Applied to your input example, the result will be:
Description, Class, HardwareID, Vendor, BIOSRelDate, BIOSVersion
xxxx System Management BIOS Driver,System,ROOT\mssmbios,American Megatrends Inc.,11/02/2016,C1043.BS.4A16.AH1
xxxx System Management BIOS Driver,System,ROOT\mssmbios,American Megatrends Inc.,10/02/2017,C1043.BS.4A25.AH1
Note that I assumed that your date format is MM/DD/YYYY
. Your example is ambiguous in that regard. If it's DD/MM/YYYY
, make the necessary adjustment.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…