xsl-list
[Top] [All Lists]

Re: choose/otherwise not doing anything?

2002-10-15 12:25:42
Hi Richard,

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.

Yeah, you're doing something really stupid -- you've just missed some
quotes :) You're doing:

  <xsl:value-of select='positive'/>

when you mean to do:

  <xsl:value-of select="'positive'"/>

though personally, I'd just use literal text rather than an
<xsl:value-of> instruction:
  
<xsl:template match="medical_assessment/tb_test_positive |
                     medical_assessment/hiv_test_positive">
  <xsl:copy>
    <xsl:choose>
      <xsl:when test=". = 'true' or . = '1'">positive</xsl:when>
      <xsl:when test=". = 'false' or . = '0'">negative</xsl:when>
      <xsl:otherwise>otherwise</xsl:otherwise>
    </xsl:choose>
  </xsl:copy>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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



<Prev in Thread] Current Thread [Next in Thread>