Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using XSL IF in data transform

Status
Not open for further replies.

divinyl

IS-IT--Management
Nov 2, 2001
163
GB
Hi all,

I have got a problem which is probably simple to solve but as I have been struggling over it for days so need some help.

I wish to use XSLT to transform XML data into HTML. One of the elements I wish to display is, for example, IsActivated which is basically a boolean yes/no element (actually stored as 1 and 0). I don't know how our system does it, but if this value it 1 it displays "yes" in the html page, and for 0 "no". What I want to be able to do is change "yes" and "no" into teh norwegian alternatives, ja and nei. I have been told that XSL IF will do this but as I am a beginner I think I need a little more help. This is a bit of my code. The first <TD> tag is fine and pulls up info from the TMProject Table. I need to do the same for the second <TD> tag excpet instead of displaying what is stored in the table, i change it to either ja or nei. I know what I have is wrong because the column comes out blank:

<code>

<TD><xsl:value-of select="TM_PROJECT.SUMMARY" disable-output-escaping="yes"/>&#160;</TD>

<TD><xsl:value-of select="CUSTOM_Travel" disable-output-escaping="yes"/><xsl:if test="./VALUE = 1 ">Ja</xsl:if> <xsl:if test="./VALUE = 0"><td>Nei</td></xsl:if> --></TD>

</code>

Let me know if you need to see more of my code, but i think this is the relevant part. HELP!

Divinyl
 
Hi,

Thanks for your reply. I realised my problem was adding all the value- of: & select: stuff. All i needed was an if test for '0' and an if test for '1' and depending on these results, writing ja or nei.

Thanks
Divinyl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top