Tuesday, 2 December 2014

I do not want to display an element in the output.



In my xml I have the following xml element which I do not want to display in the output



<ObservedEthnicity Word="R">Refused</ObservedEthnicity>


Right now based on my xslt code below I am getting the correct output meaning it is not displayed. However when I change the xml to



<ObservedEthnicity Word="H">Hispanic</ObservedEthnicity>


My output is wrong. Instead of displaying the code H it is displaying the word Hispanic


Wrong output based on the xsl code below



<nc:PersonEthnicityCode>Hispanic</nc:PersonEthnicityCode>


Instead I want this



<nc:PersonEthnicityCode>H</nc:PersonEthnicityCode>


My xslt



<nc:PersonEthnicityCode>
<xsl:choose>
<xsl:when test="//CaseParty[@ID=current()/@ID]/ObservedEthnicity/@Word='NH'">N</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//CaseParty/ObservedEthnicity/@Word"/>
</xsl:otherwise>
</xsl:choose>
</nc:PersonEthnicityCode>

No comments:

Post a Comment