This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]