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

testing for matches

Subject: testing for matches
From: "Ilyasov Jienbay" <jienbay@xxxxxxxxxxx>
Date: Mon, 04 Feb 2002 04:02:25 +0000
xsl when matches
hello list,

i have

<items>
<item>
 <date>011020<date>
 <stuff>stuff...</stuff>
 <name>jane</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
<item>
 <date>011020<date>
 <stuff>stuff...</stuff>
 <name>alfa</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
<item>
 <date>011020<date>
 <stuff>stuff...</stuff>
 <name>alfa</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
<item>
 <date>011021<date>
 <stuff>stuff...</stuff>
 <name>jane</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
<item>
 <date>011021<date>
 <stuff>stuff...</stuff>
 <name>bata</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
<item>
 <date>011020<date>
 <stuff>stuff...</stuff>
 <name>betta</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
<item>
 <date>011021<date>
 <stuff>stuff...</stuff>
 <name>jane</name>
 <stuff>stuff...</stuff>
  .
  .
</item>
</items>

and i want an output like

date               name
-----------------------
011020             jane
same as above      alfa
same as above      same as above
011021             jane
same as above      betta
011020             same as above
011021             jane

that is to have "same as above" where the previouse date/name is the same.
i've been trying something like:

<xsl:template match="item">
<xsl:choose>
<xsl:when test="not(preceding::item[position()=last()]/date=date)"> <!--for date-->
<!-- <xsl:when test="not(preceding::item[position()=last()]/name=name)"> and this one for name-->


   <xsl:value-of select="date"/><br/>
  </xsl:when>
  <xsl:otherwise>same as above</xsl:otherwise>
 </xsl:choose>
</xsl:template>
and this one for name:
<xsl:template match="item">
 <xsl:choose>
  <xsl:when test="not(preceding::item[position()=last()]/name=name)">
   <xsl:value-of select="date"/><br/>
  </xsl:when>
  <xsl:otherwise>same as above</xsl:otherwise>
 </xsl:choose>
</xsl:template>
but i dont succeed.
whats wrong?
thank you
jian

_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com



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.