Subject: RE: [xsl] doubt regarding position() mod 2 From: "Sachidanandam E K" <sachidanandam.kumaraswamy@xxxxxxxxxxxxxx> Date: Tue, 23 Apr 2002 12:55:52 +0530 |
Check this example given in this url. http://www.topxml.com/snippetcentral/main.asp?view=viewsnippet&lang=xpath&id =v20010125232950 Cheers!! Sachi -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Anand Ganapathy Sent: Tuesday, April 23, 2002 12:45 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] doubt regarding position() mod 2 Hello, I have begun working on XSL recently. I have written an XSL to convert my XML into an html which displays the xml as a tree. My XML is as given below: <?xml version="1.0" encoding="UTF-8"?> <NODE1> <NODEADDRESS>1</NODEADDRESS> <LEVELIDENTIFIER>1</LEVELIDENTIFIER> <NODENAME>All Products </NODENAME> <NODE2> <NODEADDRESS>1:1</NODEADDRESS> <LEVELIDENTIFIER>2</LEVELIDENTIFIER> <NODENAME>Meat </NODENAME> <NODE3> <NODEADDRESS>1:1:1</NODEADDRESS> <LEVELIDENTIFIER>3</LEVELIDENTIFIER> <NODENAME>Eggs </NODENAME> </NODE3> <NODE3> <NODEADDRESS>1:1:2</NODEADDRESS> <LEVELIDENTIFIER>3</LEVELIDENTIFIER> <NODENAME>Red Meat </NODENAME> </NODE3> </NODE2> <NODE2> <NODEADDRESS>1:2</NODEADDRESS> <LEVELIDENTIFIER>2</LEVELIDENTIFIER> <NODENAME>Dairy </NODENAME> </NODE2> <NODE2> <NODEADDRESS>1:3</NODEADDRESS> <LEVELIDENTIFIER>2</LEVELIDENTIFIER> <NODENAME> Chocolate </NODENAME> </NODE2> </NODE1> I need to display each alternating <NODENAME>element under <NODE2> in a different color. In my XSL, I tried using a test condition <xsl:if test="position() mod 2 = 1">, This test condition should return true for any item element that is an odd-numbered item child of its parent and hence 'Meat' and 'Chocolate' should be diplayed in the same color whereas 'Dairy' should be in a different color. However, I am getting all these in the same color.Could you please tell me where I am going wrong.Or is there a better way of achieving the same? Anand. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] doubt regarding position() m, Anand Ganapathy | Thread | RE: [xsl] doubt regarding position(, Michael Kay |
[xsl] doubt regarding position() m, Anand Ganapathy | Date | RE: [xsl] Schema location in target, Michael Kay |
Month |