[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

position() in templates

Subject: position() in templates
From: "Ilyasov Jienbay" <jienbay@xxxxxxxxxxx>
Date: Fri, 08 Feb 2002 01:26:48 +0000
get td position html
hello list,

i am still wondering if i could get some advice.
now i have problems with position() in templates.
in the html output i get 1st <td> of date repeated.
I'd use <xsl:if test position()!=1>, but position is changed.
how can i get the right position(), or is it impossible without using keys and generate-id()?(i dont want to use <xsl:for-each>)


jian

here i have xml(with some errelevant elements- just ignore them):

<?xml version="1.0"  encoding="Shift_JIS" ?>
<?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>

for this i have this xsl:

<?xml version="1.0" encoding="Shift_JIS" ?>
<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:template match="/">
<html><head><title>Same As Above</title></head>
<body>
<table border="1">
<xsl:apply-templates select="items/item">
<xsl:sort select="substring(last-modified,1,8)"/>
</xsl:apply-templates>
</table>
</body>
</html>
</xsl:template>
<!--1st LOOP-->
<xsl:template match="*">
<xsl:variable name="last" select="substring(last-modified,1,8)"/>
<xsl:if test="not(preceding-sibling::item[substring(last-modified,1,8)=$last])">
<tr><td>
jian<b><xsl:value-of select="substring(last-modified,1,8)"/>@@@<xsl:value-of select="last-modified"/></b>
</td></tr>
<xsl:apply-templates select="/items/item/last-modified" mode="a">
<xsl:with-param name="inner" select="$last"/>
<xsl:sort select="."/>
</xsl:apply-templates>
</xsl:if>
</xsl:template>
<!--2nd LOOP-->
<xsl:template match="/items/item/last-modified" mode="a">
<xsl:param name="inner"/>
<xsl:if test="substring(.,1,8)=$inner">
<tr>
<td>
same as above<b><xsl:value-of select="substring(.,1,8)"/>===<xsl:value-of select="."/></b>
</td>
</tr>
</xsl:if>
</xsl:template>
</xsl:stylesheet>


and i get this html(ignore mailto @):

<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Same As Above</title>
</head>
<body>
<table border="1">
<tr>
<td>
jian<b><a href="mailto:20000105@";>20000105@</a>@@20000105T022200</b></td>
</tr>
<tr>
<td>
same as above<b>20000105===20000105T022200</b></td>
</tr>
<tr>
<td>
same as above<b>20000105===20000105T121210</b></td>
</tr>
<tr>
<td>
same as above<b>20000105===20000105T124552</b></td>
</tr>
<tr>
<td>
same as above<b>20000105===20000105T164315</b></td>
</tr>
<tr>
<td>
same as above<b>20000105===20000105T230258</b></td>
</tr>
<tr>
<td>
jian<b><a href="mailto:20000106@";>20000106@</a>@@20000106T115305</b></td>
</tr>
<tr>
<td>
same as above<b>20000106===20000106T115305</b></td>
</tr>
<tr>
<td>
jian<b><a href="mailto:20000122@";>20000122@</a>@@20000122T022200</b></td>
</tr>
<tr>
<td>
same as above<b>20000122===20000122T022200</b></td>
</tr>
<tr>
<td>
jian<b><a href="mailto:20000812@";>20000812@</a>@@20000812T142423</b></td>
</tr>
<tr>
<td>
same as above<b>20000812===20000812T142423</b></td>
</tr>
<tr>
<td>
jian<b><a href="mailto:20000825@";>20000825@</a>@@20000825T142945</b></td>
</tr>
<tr>
<td>
same as above<b>20000825===20000825T142945</b></td>
</tr>
<tr>
<td>
same as above<b>20000825===20000825T211230</b></td>
</tr>
<tr>
<td>
same as above<b>20000825===20000825T214550</b></td>
</tr>
</table>
</body>
</html>





_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.