This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Using the xsl:if correctly
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: Using the xsl:if correctly
- From: "Eikebråten, Ståle" <eik at ssb dot no>
- Date: Tue, 21 Mar 2000 20:10:38 +0100
- Reply-To: xsl-list at mulberrytech dot com
Hi all !!
I'm new to xml/xsl, and the list has been very useful to me as it has
answered/solved a lot of my questions and problems...Thanks to all...
Looking through some "old" question, I found an answer given to Kerry Nice,
concering xls:if..
I'm trying to achieve exactly the same, but the xsl:if test does not work in
my environment.. Can someone help me with my problem..
I'm using XML and XSL to display input-fields in IE 5.0, but when testing
for a specific value IE5 returns this error :
Expected token 'eof' found '='. @Id -->=<-- 'Fnr'
This is my XSL code and XML code
<xsl:template match="Celle">
<TD>
<xsl:if test = "@Id = 'Fnr'">
<script>CreateInputFelt
"clsid:79A31234-F607-11D3-8176-0050042CD857", "<xsl:value-of
select="@Id"/>"</script>
</xsl:if>
</TD>
</xsl:template>
<Ident>Fødselsnr :
<Celle SkjemaNavn="els8_2.xml" Id="Fnr" type="I">06126945785</Celle>
</Ident>
I hope someone can help.. Thanks in advance..
-=Staale=-
> -----Opprinnelig melding-----
> Fra: Kerry Nice (DEN) [SMTP:Kerry.Nice@dcicorp.com]
> Sendt: 11. februar 2000 22:43
> Til: 'xsl-list@mulberrytech.com'
> Emne: RE: Using the xsl:if correctly
>
> Perfect,
> This is exactly what I was looking for:
> <xsl:if test="@field_type = 'textbox'">
>
> You can't believe how long (and how unsuccessfully) I spent searching the
> net for an example that does this. I guess I should have guessed this,
> but oh well.
>
> Thanks,
> Kerry.
>
> -----Original Message-----
> From: Wendell Piez [SMTP:wapiez@mulberrytech.com]
> Sent: Friday, February 11, 2000 7:56 AM
> To: xsl-list@mulberrytech.com
> Subject: Re: Using the xsl:if correctly
>
> My guess is Kerry is looking for something like:
>
> <td>
> <xsl:if test="@field_type = 'textbox'">
> <INPUT TYPE="text" Name="{$table_name}:{$column_name}"
> Value="{$field_name}"/>
> </xsl:if>
> <xsl:if test="@field_type = 'textarea'">
> <textarea Name="{$table_name}:{$column_name}"
> ROWS="4" COLS="40">
> <xsl:value-of select='.'/>
> </textarea>
> </xsl:if>
> </td>
>
> Note that this solution creates a <td> in all cases, but creates no
> content
> for it if the field_type attribute is missing or has a different value
> from
> those handled explicitly. If you need an 'else' effect, use xsl:choose
> with
> xsl:when and xsl:otherwise.
>
> --Wendell Piez
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list