How to I display currentindicator="true" for an element (approximateDateOfBirth)?



What I want to do is to change my xslt code so that when the xml document only one of ApproximateDate as in my xml document here below, then change the currentIndicator="false" to currentIndicator="true".


Desired Output



<ext:PersonBirthDate>
<ext:PersonBirthDate approximateDateIndicator="true" currentIndicator="true">1956-03-04</ext:PersonBirthDate>
</ext:PersonBirthDate>


Current output



<ext:PersonBirthDate>
<ext:PersonBirthDate approximateDateIndicator="true" currentIndicator="false">1956-03-04</ext:PersonBirthDate>
</ext:PersonBirthDate>


Here is the xml document code



<Party ID="6" InternalPartyID="27">
<Gender Word="F ">Female</Gender>
<ApproximateDOB>3/4/1956</ApproximateDOB>
</Party>

**Here is my xslt code**

<!--
New Code templates for the DateOfBirth and Approximate date for the respondent
-->
<xsl:template match="DateOfBirth">
<ext:PersonBirthDate>
<xsl:attribute name="approximateDateIndicator">false</xsl:attribute>
<xsl:attribute name="currentIndicator">false</xsl:attribute>
<xsl:value-of select="mscef:formatDate(string(.))"/>
</ext:PersonBirthDate>
</xsl:template>

<xsl:template match="DateOfBirth[@Current='true']">
<ext:PersonBirthDate>
<xsl:attribute name="approximateDateIndicator">false</xsl:attribute>
<xsl:attribute name="currentIndicator">true</xsl:attribute>
<xsl:value-of select="mscef:formatDate(string(.))"/>
</ext:PersonBirthDate>
</xsl:template>

<xsl:template match="ApproximateDOB">
<ext:PersonBirthDate>
<xsl:attribute name="approximateDateIndicator">true</xsl:attribute>
<xsl:attribute name="currentIndicator">false</xsl:attribute>
<xsl:value-of select="mscef:formatDate(string(.))"/>
</ext:PersonBirthDate>
</xsl:template>

<!--Respondent Template-->
<xsl:template name="Respondent">
<xsl:param name="pProtectionOrderID"/>
<ext:Respondent>
<nc:PersonEyeColorCode>
<xsl:value-of select="EyeColor/@Word"/>
</nc:PersonEyeColorCode>

<!--Guardian -->
<xsl:for-each select="//CaseParty[(Connection[(@Word='GRD')])][1]">
<xsl:for-each select="//Party[@InternalPartyID=current()/@InternalPartyID]">
<xsl:call-template name="Guardian"/>
<xsl:apply-templates select="ApproximateDOB|DateOfBirth"/>
</xsl:for-each>
</xsl:for-each>

<ext:PersonBirthDate>
<xsl:apply-templates select="ApproximateDOB|DateOfBirth" />
</ext:PersonBirthDate>
</ext:Respondent>

No comments:

Post a Comment