[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Conditional inclusion

Subject: Conditional inclusion
From: Brian Charlton <brian.charlton@xxxxxxxxxx>
Date: Wed, 2 Aug 2000 10:14:13 +0100
conditional inclusion
I am trying to produce an XSLT file which will translate XML to HTML.

I have a specific XSL problem:

The XML looks like this:-

<?xml version='1.0' ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<Results>
  <NumMatches><row><NUMMATCHES>18</NUMMATCHES></row></NumMatches>
  <WindowSize><row><WINDOWSIZE>10</WINDOWSIZE></row></WindowSize>
  <FirstIndex><row><FIRSTINDEX>1</FIRSTINDEX></row></FirstIndex>
  <LastIndex><row><LASTINDEX>11</LASTINDEX></row></LastIndex>
  <EventRecords>
 
<row><SEQ>1</SEQ><TIMESTAMP>14:34:25.0</TIMESTAMP><EVENTTYPE>LGUT</EVENTTYPE
><EVENTSOURCE>FRAUD</EVENTSOURCE></row>
 
<row><SEQ>2</SEQ><TIMESTAMP>14:34:26.0</TIMESTAMP><EVENTTYPE>LGIN</EVENTTYPE
><EVENTSOURCE>FRAUD</EVENTSOURCE></row>
    ...
    --- contains WINDOWSIZE records ---
    ...
 
<row><SEQ>10</SEQ><TIMESTAMP>14:34:26.0</TIMESTAMP><EVENTTYPE>LGIN</EVENTTYP
E><EVENTSOURCE>FRAUD</EVENTSOURCE></row>
  </EventRecords>
</Results>

I need to produce a list of events containing WINDOWSIZE records.
I need to conditionally append a NEXT hyperlink at the end of the list of
WINDOWSIZE records if LASTINDEX < NUMMATCHES.
I have a template which converts each <Results><EventRecords><row> element
into HTML.

How do I conditionally include the NEXT option?

IN XSLT I need to somwhow encode:-

if LASTINDEX < NUMMATCHES then include NEXT

Anyone have any idea?  I've considered creating a param/variable with the
value of the NUMMATCHES element but all of the examples I have seen always
assign a constant.  I imagine that the order in which template are applied
cannot be guaranteed.

I have also tried xsl:if but I cannot figure out how to construct the test:-

	<xsl:if test="{Results/NumMatches/row/NUMMATCHES} &gt;
{Results/LastIndex/row/LASTINDEX}" >

does not compute.

Any good samaritans out there?

Regards

Bri











 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.