Subject: RE: [xsl] choose/otherwise not doing anything? From: "Maesen, Edward" <emaesen@xxxxxxxx> Date: Tue, 15 Oct 2002 12:16:10 -0700 |
If any of the tests is true, for instance <xsl:when test="text()='1'">, then the output is <xsl:value-of select='positive'/> which is an empty node. Look at the quotes. Be sure to use appropriate quotes when outputting a string: Try <xsl:value-of select="'positive'"/>. All the value-of statements (except in the otherwise) lack the double quotes. Edward > -----Original Message----- > From: Richard Rowell [mailto:richard@xxxxxxxxxxxxxxxxx] > Sent: Tuesday, October 15, 2002 12:06 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] choose/otherwise not doing anything? > > > 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 > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] choose/otherwise not doin, Jeni Tennison | Thread | [xsl] How can repitition be avoided, Raghava Rao |
[xsl] choose/otherwise not doing an, Richard Rowell | Date | AW: [xsl] choose/otherwise not doin, Peter Menzel |
Month |