Article View: fr.comp.text.xml
Article #9193Need help... Test an element??
From: Vincent Berruchon
Date: Thu, 10 May 2001 10:26
Date: Thu, 10 May 2001 10:26
77 lines
3438 bytes
3438 bytes
Hi, I'd like to write comments about my data.
for exemple if RecrutNum >0 .. I'd like to write "increase"
RecrutNum =0 .. I'd like to write "no change"
else I'd like to write "decrease"
I don't understand how to test the value of an element ( RecrutDiscard).
my .xml :
----
<?xml version="1.0"?>
<Report>
<Id>F2</Id>
<Title></Title>
<DateBeg>23/01/2001 </DateBeg>
<DateEnd>31/01/2001</DateEnd>
<RecrutNum>104</RecrutNum>
<RecrutDiscard>22</RecrutDiscard>
<LostNum>75</LostNum>
<LostDiscard>13</LostDiscard>
</Report>
---
my .xsl:
--------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<HTML>
<HEAD>
</HEAD>
<BODY>
<TABLE width="100%" cellspacing="0">
<TR>
<TD><DIV id="listing"><xsl:apply-templates match="Report"/></DIV></TD>
</TR>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="Report">
<TABLE STYLE="background-color:white" width="400">
<TR>
<TD colspan="2">Au cours de la semaine du <Font
color="red"><xsl:value-of select="DateBeg"/></Font> au <Font
color="red"><xsl:value-of select="DateEnd"/></Font></TD>
</TR>
<TR>
<TD width="40"></TD><TD><span class="inserted"><xsl:value-of
select="RecrutNum"/></span> arrivals :
<xsl:choose>
<xsl:when test="@RecrutDiscard > 0">
<xsl:text>
increase of <Font color="red"><xsl:value-of
select="RecrutDiscard"/>%</Font>
<xsl:/text>
</xsl:when>
<xsl:when test="@RecrutDiscard = 0">
<xsl:text>no change<xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>
decrease <Font color="red"><xsl:value-of
select="RecrutDiscard"/>%</Font>
<xsl:text>
</xsl:otherwise>
</xsl:choose>
since last week</TD>
</TR>
</TABLE>
</xsl:template>
</xsl:stylesheet>
---
What is the problem? How to test (with if or choose)
Thanks for your help (if possible, please reply also to vinzzz@noos.fr )
Vincent
Technical Details
Message-ID:
<B1uK6.72$aB5.22415@tengri.easynet.fr>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!freenix!easynet-fr!tengri.easynet.fr!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114f60,92ec00df5e179645,start X-Google-Attributes: gid114f60,public X-Google-Thread: 110868,92ec00df5e179645,start X-Google-Attributes: gid110868,public X-Google-Thread: 1006ac,92ec00df5e179645,start X-Google-Attributes: gid1006ac,public X-Google-Thread: 1047a4,92ec00df5e179645,start X-Google-Attributes: gid1047a4,public X-Google-ArrivalTime: 2001-05-10 03:32:06 PST Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!freenix!easynet-fr!tengri.easynet.fr!not-for-mail From: "Vincent Berruchon" <vinzzz@noos.fr> Newsgroups: fr.comp.text.xml,microsoft.public.xml,microsoft.public.xsl,netscape.public.dev.xml Subject: Need help... Test an element?? Lines: 79 X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Message-ID: <B1uK6.72$aB5.22415@tengri.easynet.fr> Date: Thu, 10 May 2001 12:26:41 +0200 NNTP-Posting-Host: 212.180.93.14 X-Complaints-To: abuse@easynet.fr X-Trace: tengri.easynet.fr 989490401 212.180.93.14 (Thu, 10 May 2001 12:26:41 MET DST) NNTP-Posting-Date: Thu, 10 May 2001 12:26:41 MET DST Organization: [Posted via] Easynet France