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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie help please -- xsl:when test syntax problem

Status
Not open for further replies.

spiel2001

Programmer
Nov 1, 2001
39
US
Sorry to ask such a simple question, but I've been trying to finddecent documentation on the test syntax all evening to no avail and time's wasting. What I need to do is very simple...

in 'C' syntax...

char *my_tag = "123.1";

if( atol( my_tag ) > 0.0 ) do_this();
else if ( atol( my_tag ) < 0.0 ) do_that();
else do_nothing();

Ok... That's simple enough. Now, in XSL I thought...

In the XML document...

<MyXMLBlock>
<MyTag value=&quot;123.1&quot;/>
</MyXMLBlock>

and in the XSL style sheet...

<xsl:choose>
<xsl:when test=&quot;/MyXMLBlock/MyTag/@value[. > 0.0]&quot;>
<!-- do this -->
</xsl:when>
<xsl:eek:therwise>
<xsl:when test=&quot;/MyXMLBlock/Mytag/@value[. < 0.0]&quot;>
<!-- do that -->
</xsl:when>
<xsl:eek:therwise>
<!-- do nothing -->
</xsl:eek:therwise>
</xsl:eek:therwise>
</xsl:choose>

Where I am getting an error is in the [. < 0.0] and [. > 0.0] -- the IE 5.5 browser is giving me a rather cryptic message stating I can not use &quot;<&quot; or &quot;>&quot; in the context.

Can someone either assist me with a solution to this very simple problem or, better still, point me to a good on-line XSL language reference where I can get useful information on the reserved words, boolean operations and such?

many thanks to any and all who can help an XSL newbie get his feet wet.

Scott.
 
Hi Scott,

xsl:when can't occur within xsl:eek:therwise. A typical syntax like

If
Elseif
Elseif
Else

Will be

xsl:when
xsl:when
xsl:when
xsl:eek:therwise

Second xsl(t) doesn't like it when you use the < and > signs in evaluations. Instead use their corresponsive html notations.

Online info?
w3.org
msdn.microsoft.com

Or look at the partners section in this forum (below member-feedback).

Jordi Reineman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top