[xsl] choose/otherwise not doing anything?

Subject: [xsl] choose/otherwise not doing anything?
From: Richard Rowell <richard@xxxxxxxxxxxxxxxxx>
Date: 15 Oct 2002 14:06:09 -0500
I'm sure I'm doing something really stupid, but I cant figure out for
the life of me why the following template always outputs and empty
element.  The choose has an otherwise and I would expect that to be
output (if nothing else).  No matter what I put as the input it produces
an empty element as an output.  IE:

(input)
   <medical_assessment>
    <tb_test_positive>1</tb_test_positive>
    <tb_test_positive>true</tb_test_positive>
    <hiv_test_positive>false</hiv_test_positive>
    <hiv_test_positive>0</hiv_test_positive>
   ...
   </medical_assessment>

produces:
<medical_assessment>
<tb_test_positive/>
<tb_test_positive/>
<hiv_test_positive/>
<hiv_test_positive/>
...
</medical_assessment>

I would expect to (at least) get "otherwise". My template follows:

  <xsl:template match="medical_assessment/tb_test_positive |
medical_assessment/hiv_test_positive">
   <xsl:element name="{name()}">
    <xsl:choose>
     <xsl:when test="text()='true'">
      <xsl:value-of select='positive'/>
     </xsl:when>
     <xsl:when test="text()='1'">
      <xsl:value-of select='positive'/>
     </xsl:when>
     <xsl:when test="text()='false'">
      <xsl:value-of select='negative'/>
     </xsl:when>
     <xsl:when test="text()='0'">
      <xsl:value-of select='negative'/>
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="'otherwise'"/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:element>
  </xsl:template>





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread