[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Alternating rows with multiple tables
> The problem is that if the first table has an odd > number of rows, then "position() mod 2" will cause the first row of the > second table to be the wrong color. your problem is I think that you are selecting the wrong node list (guessing from your code, without seeing the input) position() doesn't work as you suggest above it doesn't normally maintain a global count, but rather just gives the position in the current node list (ie the nodes in the currently active step of a path or apply-templates or for-each.) And that's your problem, you have a for-each selecting a node list but then you are only processing some of the nodes, due to the nested xsl:ifs so position() gives th eposition in the current notde list and so will not alternate th ecolours unless you xsl:if always omit rows in pairs. The solution is just to select tghe nodes you want rather than slect too many and then do nothing for some of them: ie don't do this: <xsl:for-each select="*/tasked_country_segment/service_tasked_segment/task_unit_and_loca tion_segment"> <xsl:if test ="aircraft_mission_data_segment/aircraft_mission_data/package_identificati on!=''"> <xsl:if test="aircraft_mission_data_segment/aircraft_mission_data/mission_number=$ mission_id"> do this <xsl:for-each select="*/tasked_country_segment/service_tasked_segment/task_unit_and_loca tion_segment [aircraft_mission_data_segment/aircraft_mission_data/package_identification!='' and aircraft_mission_data_segment/aircraft_mission_data/mission_number=$mission_id ]"/> David _____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Scanning Service. For further information visit http://www.star.net.uk/stats.asp or alternatively call Star Internet for details on the Virus Scanning Service. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|