XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 9th, 2003, 02:45 PM
achandak achandak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 22 achandak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old July 9th, 2003, 04:32 PM
achandak achandak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 22 achandak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old July 10th, 2003, 08:10 AM
achandak achandak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 22 achandak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks a lot for your help echolalia.

It Worked!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > problem with position() function


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway