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

testing for matches using variables

Subject: testing for matches using variables
From: "Ilyasov Jienbay" <jienbay@xxxxxxxxxxx>
Date: Mon, 04 Feb 2002 04:45:58 +0000
match test using last names
hi,

i guess i found it, i made it like this:
<xsl:template>
 <xsl:choose>
  <xsl:when test="not(preceding::item[1]/name=name)">
   <xsl:value-of select="name"/>
  </xsl:when>
  <xsl:otherwise>same as above</xsl:otherwise>
 </xsl:choose>
</xsl:template>
but now, i have to use "$name" variable instead of "name" element.
any suggestions?
jian

<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>


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.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.