|
Subject: RE: [xsl] <xsl:choose> not working -- always results with <xsl: otherwise>? From: "Passin, Tom" <tpassin@xxxxxxxxxxxx> Date: Mon, 8 Sep 2003 14:24:08 -0400 |
[Kathy Burke]
> Hi, I'm trying to use the following choose statement, but
> when I change my
> xml text to test for both conditions, the results of
> <xsl:otherwise> always
> show, never the first <choose> which tests (I thought) to see
> if the text
> node of <measure> is empty. If <measure> is an empty element,
> I would like
> to give the user an input box, otherwise, just show the data already
> entered. Any help appreciated. Thanks.
>
> The xml is simply either <measure name="firstpass">20 mm</measure> or
> <measure name="firstpass/>.
>
> <xsl:template match="measure">
> <xsl:choose>
> <xsl:when test="normalize-space(.)">
You probably want
not(normalize-space(.)
^^^
> <input type="text" name="{@name}" value="{.}"/>
> </xsl:when>
> <xsl:otherwise>
> Entered: <value-of select="."/>
You meant to write
<xsl:value-of select="."/>
^^^
> </xsl:otherwise>
> </xsl:choose>
> </xsl:template>
>
With these corrections, it does what you want.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] <xsl:choose> not working -- a, Kathy Burke | Thread | [xsl] XSL FO: Marker works nicely b, SANWAL, ABHISHEK (HP |
| [xsl] XSL FO: Marker works nicely b, SANWAL, ABHISHEK (HP | Date | Re: [xsl] formatting xml output: in, Wendell Piez |
| Month |