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]

RE: Why does this work?


Hi,

...
->I solved it with the following template (this assumes that the data is
->ordered by customer):
->
-><xsl:template match="row">
-> <xsl:choose>
->  <xsl:when test="customer = preceding::row[position()=1]/customer">
->   <td>&nbsp;</td>
->  </xsl:when>
->  <xsl:otherwise>
->   <td><xsl:value-of select="customer"/>
->  </xsl:otherwise>
-> </xsl:choose>
-> <td><xsl:value-of select="account"/></td>
-></xsl:template>
->
->Now I'm glad it works, but for some peace of mind I would 
->like to know why 
-><xsl:when test="customer = preceding::row[position()=1]/customer"> 
->behaves as it does?

You take the preceding axis gives you the elements before your element in
reverse order, the element directly before your current element is the one
you get first.  And because your input is sorted that's why your stylesheet
works...

->Thanks in advance,
->Christian Schmitt

bye
Frank
-
Frank Spychalski
Research Engineer
SAP Labs, Palo Alto           frank.spychalski@sap.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]