Could you please advise on how I can build the XSLT logic using the below XML? I need to be able to sort by BIOSReldate and create two rows for BIOSReldate and BIOSVersion combination.
My final output should have the following attributes in a .CSV
Description, Class, HardwareID, Vendor, BIOSRelDate, BIOSVersion
<!---
There are two BIOSRelDate and BIOSVersion instances and need to generate them as multiple rows
<Device Count="1" Description="xxxx System Management BIOS Driver"
Class="System" DeviceType="Smbios">
<HardwareIDs>
<ID Value="ROOTmssmbios" />
</HardwareIDs>
<Properties>
<Vendor Value="American Megatrends Inc." />
<BIOSRelDate Value="11/02/2016" />
<BIOSVersion Value="C1043.BS.4A16.AH1" />
<BIOSRelDate Value="10/02/2017" />
<BIOSVersion Value="C1043.BS.4A25.AH1" />
</Properties>
</Device>
Below is what I tried -
<xsl:apply-templates select="Device/Properties">
<xsl:sort select="BIOSRelDate" data-type="number" order="ascending"/>
</xsl:apply-templates>
...
<xsl:template match="BIOSRelDate">
<!--Duplicate all Properties data for each BIOSRelDate-->
<Device>
<xsl:value-of select="../*[not(self::BIOSRelDate)] | ."/>
</Device>
</xsl:template>
See Question&Answers more detail:os