|
[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: counter in xsl
Subject: Re: counter in xsl
From: "Ilyasov Jienbay" <jienbay@xxxxxxxxxxx>
Date: Fri, 08 Feb 2002 11:39:48 +0000
|
hi,
...but i cant access position().
i want to <position() mod 2=0> in *outer* <tr> of a <table> for the
<bgcolor>.
what can i do? here is my xsl, and xml.
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="prose.xsl" ?>
<items>
<item>
<id>xx0xx</id>
<name>?W????</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000122T022200</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx1xx</id>
<name>?¨?¨?½?É</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000105T022200</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx2xx</id>
<name>?¨?¨?½?É</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000105T121210</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx3xx</id>
<name>?¨?¨?½?É</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000106T115305</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx4xx</id>
<name>?¨?¨?½?É</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000105T230258</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx5xx</id>
<name>?¢?í?½</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000105T164315</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx6xx</id>
<name>?¢?í?½</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000105T124552</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx7xx</id>
<name>?W????</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000825T142945</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx8xx</id>
<name>?W????</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000825T214550</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx9xx</id>
<name>?¨?¨?½?É</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000825T211230</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
<item>
<id>xx10xx</id>
<name>?½?È?©</name>
<user-id>ohtani@xxxxxxxxxxxxxxxxxx</user-id>
<last-modified>20000812T142423</last-modified>
<created>20000106T115305</created>
<attachment>file.txt</attachment>
<refer>?V?¶???Ìid</refer>
<revision>20000106T115305</revision>
<axpire>20000106T115305</axpire>
<private>no</private>
<delete>no</delete>
</item>
</items>
and xsl is:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:arx="http://www.ariel-networks.com/airone/xalan-ext" version="1.0"
exclude-result-prefixes="arx">
<xsl:output method="html" version="4.01" />
<xsl:param name="somanet_id" />
<xsl:param name="appname" />
<xsl:param name="theme" />
<xsl:key name="lastkey" match="item" use="substring(last-modified,1,8)"/>
<xsl:template match="/">
<html><head><title>Same As Above</title></head>
<body>
<table border="1">
<xsl:apply-templates
select="//item[generate-id(.)=generate-id(key('lastkey',
substring(last-modified,1,8))[1])]" mode="a">
<xsl:sort select="substring(last-modified,1,8)"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="//item" mode="a">
<xsl:apply-templates select="key('lastkey',
substring(last-modified,1,8))">
<xsl:sort select="last-modified"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="//item">
<tr>
<xsl:attribute name="bgcolor">
<xsl:choose>
<xsl:when test="position()=1">
<xsl:text>pink</xsl:text>
</xsl:when>
<xsl:when test="position() !=1">
<xsl:if test="position() mod 2=0">
<xsl:text>#e7f2ff</xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:choose>
<xsl:when test="position()=1">
<td><xsl:value-of select="substring(last-modified,1,8)"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="substring(last-modified,10,4)"/></td>
</xsl:when>
<xsl:otherwise><td></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="substring(last-modified,10,4)"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:template>
</xsl:stylesheet>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list

| Current Thread |
- counter in xsl
- thenewmatrix - Fri, 8 Feb 2002 04:32:38 -0500 (EST)
- <Possible follow-ups>
- Ilyasov Jienbay - Fri, 8 Feb 2002 06:37:38 -0500 (EST) <=
|
|
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
| RSS 2.0 |
|
| Atom 0.3 |
|
|