Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


xslt problem for-each loop

From: "Chris Millar" <chris.millar@---------.--->
To: NULL
Date: 5/6/2004 5:56:00 PM
I have the following xml file:

<?xml version="1.0" encoding="UTF-8"?>
<untable>
<unavail>
<timeline>111111111111111111111111111111111111111111000000000000111111111111
11111111111111111111111111111111111111</timeline>
<type>1</type>
<date>22/01/2004</date>
</unavail>
</untable>

I have an xslt were i want to create html based on the timeline information.

For each bit in the timeline element 1 or 0 I wish to create a TD element in
a HTML table there are always 96 bits.

The background color i want to set to black if the value of the current
timeline bit is 1 and red if the current timeline bit is 0.

The xsl is below, the problem i have is that i don't understand how i can do
the template match as there aren't 96 consecutive timeline elements to do it
with i.e <timeline>0</timeline><timeline>0</timeline> ... to 96. where i
could use <xsl:for-each>


can anyone help.


xsl:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;">
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<html>
<head>
<script src="file:///C|/Documents and
Settings/Administrator/Desktop/Avail/avail.js" type="text/javascript"/>
<link
href="file:///C|/Documents%20and%20Settings/Administrator/Desktop/Avail/avai
l.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- header section for week num and Timeline intervals-->
<table width="1003" border="0" cellpadding="1" cellspacing="0"
bgcolor="#0066CC">
<tr valign="top" bgcolor="#7b9ebd" class="style7">
<td width="115" height="28" align="right" valign="middle">Time Periods:</td>
<td width="108" valign="middle">
<select name="select">
<option>Hourly</option>
<option>1/2 Hourly</option>
<option>1/4 Hourly</option>
</select>
</td>
<td width="77" align="right" valign="middle">Week No:</td>
<td width="86" align="center" valign="middle">
<table width="46" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10">
<input name="textfield" type="text" class="style19" size="2" maxlength="2"/>
</td>
<td width="36">
<img
src="file:///C|/Documents%20and%20Settings/Administrator/Desktop/Avail/image
s/btn_off_cal.gif" width="36" height="19"/>
</td>
</tr>
</table>
</td>
<td width="607">&nbsp;</td>
</tr>
</table>
<!-- end of section for week num and Timeline intervals-->
<!--start of timeline section-->
<table border="1" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF"
OnMousedown="mouseDown(event)" onMouseUp="lmouseup()"
onMouseMove="changeto(event)">
<tr bgcolor="#7b9ebd">
<td align="center" class="style9" id="ignore">Week Day</td>
<td align="center" class="style9">Week Date </td>
<td colspan="4" class="style7">00:00</td>
<td colspan="4" class="style7">01:00</td>
<td colspan="4" class="style7">02:00</td>
<td colspan="4" class="style7">03:00</td>
<td colspan="4" class="style7">04:00</td>
<td colspan="4" class="style7">05:00</td>
<td colspan="4" class="style7">06:00</td>
<td colspan="4" class="style7">07:00</td>
<td colspan="4" class="style7">08:00</td>
<td colspan="4" class="style7">09:00</td>
<td colspan="4" class="style7">10:00</td>
<td colspan="4" class="style7">11:00</td>
<td colspan="4" class="style7">12:00</td>
<td colspan="4" class="style7">13:00</td>
<td colspan="4" class="style7">14:00</td>
<td colspan="4" class="style7">15:00</td>
<td colspan="4" class="style7">16:00</td>
<td colspan="4" class="style7">17:00</td>
<td colspan="4" class="style7">18:00</td>
<td colspan="4" class="style7">19:00</td>
<td colspan="4" class="style7">20:00</td>
<td colspan="4" class="style7">21:00</td>
<td colspan="4" class="style7">22:00</td>
<td colspan="4" class="style7">23:00</td>
<td colspan="4" class="style7">24:00</td>
</tr>
</table>
<!--end of timeline section-->
<!-- start of day times section-->
<xsl:variable name="testvar">96</xsl:variable>
<table>
<tr>
<td bgcolor="#7b9ebd" class="style15" id="ignore">Monday</td>
<td bgcolor="#7b9ebd" class="style15">19/01/2004 <xsl:value-of
select="$testvar"></xsl:value-of></td>
</tr>
</table>
<!-- <td class="unnamed2">&nbsp;</td>-->
<!-- end of day times section -->
<!--Start of section for planner legend -->
<table width="800" border="1" cellpadding="1" cellspacing="0"
bordercolor="#FFFFFF">
<tr>
<td width="154" class="style9">Planner Legend: </td>
<td width="29" bordercolor="#000000" bgcolor="#0000FF" class="style18"
onMouseDown="changehighlightcolor('blue')">&nbsp;</td>
<td width="216" align="center" class="style15"> Regular Unavailabilty</td>
<td width="36" bordercolor="#000000" bgcolor="#FF0000" class="style18"
onMouseDown="changehighlightcolor('red')">&nbsp;</td>
<td width="190" align="center" class="style15">Requirements</td>
<td width="36" bordercolor="#000000" bgcolor="#009900" class="unnamed2"
onMouseDown="changehighlightcolor('green')">&nbsp;</td>
<td width="179" align="center" class="style15">Specific Unavailability</td>
<td width="36" align="center" bordercolor="#000000" class="unnamed2"
onMouseDown="changehighlightcolor('white')">&nbsp;</td>
<td width="123" align="center" class="style15">Delete Times </td>
</tr>
<tr>
<td colspan="9" class="style19">Please click a colour then drag &amp; drop
unavailability, Right click button to edit unavailbilty description and
notes. </td>
</tr>
</table>
<!-- end of section for planner legend -->
</body>
</html>
</xsl:template>
</xsl:stylesheet>


Cheers

chris.




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent