|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
problem with position() function
Hi,
I want to display alternate rows of a table in different colors and I know a technique using the "position() mod 2" which will do the task. But position() function is not recognized by my browser when I use namespace as <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/TR/WD-xsl">. It is recognized only when I use the namespace as <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> But if I use ...1999/XSL/Transform namespace, the page doesnt display properly in the older version of the browsers which do not have the latest MSXML installed. I cannot expect the users to update their browsers for this application. How do I get this done by using TR/WD-xsl namespace? Thanks |
|
#2
|
|||
|
|||
|
I dont mind switching to the ....1999/XSL/Transform namespace, but when I do so and use position() the page doesnt display properly on some of the browsers.
Ok, can you help me in figuring out why this code (which is the solution to the original problem) is not working... XSL : ----- <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="reference_item_list.xsl"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML> <HEAD> <META NAME="Generator" CONTENT="EditPlus"/> <META NAME="Author" CONTENT=""/> <META NAME="Keywords" CONTENT=""/> <META NAME="Description" CONTENT=""/> <LINK REL="stylesheet" TYPE="text/css" TITLE="CARMStyle" HREF="..\content.css"/> </HEAD> <body bgcolor="#eeeeee"> <table border="0" width="660"> <tr> <td colspan="2"> <table width="100%" border="0"> <thead> <td/> <td> <b> <DIV onClick="sort('REF_ITEM_CODE')"> <xsl:value-of select="REF_ITEM_LIST/REF_ITEM/REF_ITEM_CODE/@LABEL"/> </DIV> </b> </td> <td> <b> <xsl:value-of select="REF_ITEM_LIST/REF_ITEM/REF_ITEM_DESC/@LABEL"/> </b> </td> </thead> <xsl:for-each select="REF_ITEM_LIST/REF_ITEM"> <tr> <xsl:attribute name="class"> color<xeval>childNumber(this)%2 </xeval> </xsl:attribute> <td> <input type="radio" name="ref_item_list"> <xsl:attribute name="value"><xsl:value-of select="REF_ITEM_CODE"/></xsl:attribute> </input> </td> <td> <xsl:value-of select="REF_ITEM_CODE"/> </td> <td> <xsl:value-of select="REF_ITEM_DESC"/> </td> </tr> </xsl:for-each> </table> </td> </tr> </table> </body> </HTML> </xsl:template> </xsl:stylesheet> ======== XML ======== <?xml version="1.0" encoding="ISO-8859-1"?> <?xml:stylesheet type="text/xsl" href="reference_item_list.xsl"?> <REF_ITEM_LIST> <REF_ITEM> <REF_ITEM_CODE LABEL="Code">111006</REF_ITEM_CODE> <REF_ITEM_DESC LABEL="Description">PARK AVENUE-MT</REF_ITEM_DESC> </REF_ITEM> <REF_ITEM> <REF_ITEM_CODE LABEL="Code">111005</REF_ITEM_CODE> <REF_ITEM_DESC LABEL="Description">WILLIAM STREET-MC</REF_ITEM_DESC> </REF_ITEM> <REF_ITEM> <REF_ITEM_CODE LABEL="Code">110100</REF_ITEM_CODE> <REF_ITEM_DESC LABEL="Description">TORONTO BRANCH WDA</REF_ITEM_DESC> </REF_ITEM> <REF_ITEM> <REF_ITEM_CODE LABEL="Code">111003</REF_ITEM_CODE> <REF_ITEM_DESC LABEL="Description">TRIBECA-MC</REF_ITEM_DESC> </REF_ITEM> </REF_ITEM_LIST> =============== CSS =============== color0{ color: red; } color1{ color: blue; } Thanks Amit |
|
#3
|
|||
|
|||
|
Thanks a lot for your help echolalia.
It Worked!! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > problem with position() function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|