i'm trying to populate the created date time based on some other values. if insertion date is null then now should be entered else insertion date would be displayed. see below the input
<?xml version="1.0"?>
<a>
<x>
<id>468441</id>
<fields>
<field name="createdDateTime"/>
<field name="x">1</field>
</fields>
<b>
<queryResults>
<record id="1">
<column name="Now">2014-06-12T16:05:18+03:00</column>
<column name="InsertionDate"/>
</record>
</queryResults>
</b>
</x>
<x>
<id>468440</id>
<fields>
<field name="createdDateTime"/>
<field name="x"/>
</fields>
<b>
<queryResults>
<record id="1">
<column name="Now">2014-06-12T16:05:18+03:00</column>
<column name="InsertionDate">2015-06-12T15:25:28+03:00</column>
</record>
</queryResults>
</b>
</x>
</a>
The desired output is
<?xml version="1.0"?>
<a>
<x>
<id>468441</id>
<fields>
<field name="createdDateTime">2014-06-12T16:05:18+03:00</field>
<field name="x">1</field>
</fields>
<b>
<queryResults>
<record id="1">
<column name="Now">2014-06-12T16:05:18+03:00</column>
<column name="InsertionDate"/>
</record>
</queryResults>
</b>
</x>
<x>
<id>468440</id>
<fields>
<field name="createdDateTime">2015-06-12T15:25:28+03:00</field>
<field name="x"/>
</fields>
<b>
<queryResults>
<record id="1">
<column name="Now">2014-06-12T16:05:18+03:00</column>
<column name="InsertionDate">2015-06-12T15:25:28+03:00</column>
</record>
</queryResults>
</b>
</x>
</a>
see below my xslt 1.0 code but it doesn't return desired output
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="field[@name='createdDateTime']">
<field name="createdDateTime">
<xsl:choose>
<xsl:when test="././b/queryResults/record/column[@name='InsertionDate'] ='' ">
<xsl:value-of select="././b/queryResults/record/column[@name='Now']"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="././b/queryResults/record/column[@name='InsertionDate']"/>
</xsl:otherwise>
</xsl:choose>
</field>
</xsl:template>
</xsl:stylesheet>