The following is my output based on my xslt code which I had pasted below. This output has repeated ext:PersonBirthDate. I want to remove the first and last ext:PersonBirthDate I only want to have the 3 extPersonBirthdate but not the parent. How do I do it? Here is the output
<ext:PersonBirthDate>
<ext:PersonBirthDate approximateDateIndicator="true" currentIndicator="false">1956-03-04</ext:PersonBirthDate>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="false">1956-04-21</ext:PersonBirthDate>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1956-05-21</ext:PersonBirthDate>
</ext:PersonBirthDate>
I want my output to look like this
<ext:PersonBirthDate approximateDateIndicator="true" currentIndicator="false">1956-03-04</ext:PersonBirthDate>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="false">1956-04-21</ext:PersonBirthDate>
<ext:PersonBirthDate ext:approximateDateIndicator="false" ext:currentIndicator="true">1956-05-21</ext:PersonBirthDate>
My xml document
<Party ID="14474176" InternalPartyID="1612366618">
<Gender Word="F ">Female</Gender>
<ApproximateDOB>3/4/1956</ApproximateDOB>
<DateOfBirth>04/21/1956</DateOfBirth>
<DateOfBirth Current="true">05/21/1956</DateOfBirth>
</Party>
Here is my xslt code
<!--Templates for DateOfBirth for the respondent-->
<xsl:template match="DateOfBirth">
<ext:PersonBirthDate>
<xsl:attribute name="ext:approximateDateIndicator">false</xsl:attribute>
<xsl:attribute name="ext: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="ext:approximateDateIndicator">false</xsl:attribute>
<xsl:attribute name="ext:currentIndicator">true</xsl:attribute>
<xsl:value-of select="mscef:formatDate(string(.))"/>
</ext:PersonBirthDate>
</xsl:template>
<!--Templates for ApproximateDOB for the respondent-->
<xsl:template match="ApproximateDOB">
<ext:PersonBirthDate approximateDateIndicator="true" currentIndicator="{not(../DateOfBirth)}" >
<xsl:value-of select="mscef:formatDate(string(.))"/>
</ext:PersonBirthDate>
</xsl:template>
<!--Respondent Template-->
<xsl:template name="Respondent">
<xsl:param name="pProtectionOrderID"/>
<ext:Respondent>
<!--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:Respondent>
</xsl:template>
No comments:
Post a Comment