'Trying to Format a Date in XML

Looking for assistance on how to format a date in XML. Currently, the stylesheet outputs a format of DD-MM-YYYY (due to the software being developed in Europe). However, for my purposes, the US standard is needed (MM-DD-YYYY). The two variables I am trying to reformat are SD and ED (at the end of the stylesheet).

Here is an XML example:

<?xml version="1.0" encoding="UTF-8"?>
<R>

<ST BC="TK2403Y" LT=" " ME="100" NM="41G2484-BA20-000-A4" NMP="41G2484-BA20-000-A4" 
OP="Administrator" PA="0" SD="14-03-2022 08:06:21" SI="0" TN="PILOT V8AP S/N 201752" 
TS="Normal Test" WS=""/>

<BI AK="0" BC="" BCP="TK2403Y" ID="0" NF="0" NT="437" SD="14-03-2022 08:06:21" TR="0" 
TT="127">
</BI>

<ET AK="0" BC="TK2403Y" DM="0" ED="14-03-2022 08:08:29" LT=" " NF="0" NM="41G2484-BA20-000-A4" 
NMP="41G2484-BA20-000-A4" NT="437" OP="Administrator" TR="0" TT="00:02:07">
</ET>

</R>

Here is the stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />

<xsl:template match="R">
    <X_file version="Xfile2.0">
        <DataRecord>
            <xsl:apply-templates select="BI"/>
        </DataRecord>
    </X_file>
</xsl:template>

<xsl:template match="BI">

    <!-- System Information -->
    <TestSystem>
        <TestSystemNumber>T0030</TestSystemNumber>
        <TestSystemName>Seica V8 Flying Prober</TestSystemName>
        <TestSystemType>FP</TestSystemType>
        <ProductionLineName></ProductionLineName>
    </TestSystem>

    <!-- Software Information -->
    <Software>
        <TestSoftwareName>Seica VIP Platform - VIVA Software</TestSoftwareName>
        <TestSoftwareRevision></TestSoftwareRevision>
        <TestScriptName></TestScriptName>
        <TestScriptRevision></TestScriptRevision>
        <RouteVerification></RouteVerification>
    </Software>

    <!-- Fixture Information -->
    <Fixture>
        <FixtureNumber></FixtureNumber>
        <FixtureName></FixtureName>
    </Fixture>

    <!-- Assembly Information -->
    <Assembly>
        <AssemblyName></AssemblyName>
        <AssemblyRevision><xsl:value-of select="/R/ST/@NM"/></AssemblyRevision>
        <BoardName></BoardName>
    </Assembly>

    <!-- Test Information -->
    <TestData>
        <TestStartDateTime><xsl:value-of select="/R/ST/@SD"/></TestStartDateTime>
        <TestEndDateTime><xsl:value-of select="/R/ET/@ED"/></TestEndDateTime>


    
xml


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source