This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Conditional inclusion
- To: xsl-list at mulberrytech dot com
- Subject: Conditional inclusion
- From: Brian Charlton <brian dot charlton at vega dot co dot uk>
- Date: Wed, 2 Aug 2000 10:14:13 +0100
- Reply-To: xsl-list at mulberrytech dot com
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} >
{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