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

ReRe: in for-each apply-templates doesnot work

Subject: ReRe: in for-each apply-templates doesnot work
From: "Yang" <sfyang@xxxxxxxxxxxxx>
Date: Thu, 20 Sep 2001 14:50:55 +0800
xsl for each apply templates
Hi ,Jochen

For your problem, Mike specifically points out this is type of group ;

>This is essentially a grouping problem, where you are only interested in
>groups of size 2 or more. As the grouping key is a compound key (it's not
>the string-value of a node), take a look at Muenchian grouping,

Base on your posted xml and xsl , the following xslt using Muenchian method
with the compound key of attr name0 and name1 is given here for your
reference.
Hope you will find it useful.

  <?xml version="1.0" encoding="ISO-8859-1" ?>
- <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40">
  <xsl:output method="html" />
  <xsl:key name="checkItem" match="row" use="concat(@name0,'::',@name1)" />
  <xsl:strip-space elements="*" />
- <xsl:template match="/gentable">

- <xsl:for-each
select="body/row[generate-id(.)=generate-id(key('checkItem',concat(@name0,':
:',@name1))[1])]">
- <xsl:if test="count(key('checkItem',concat(@name0,'::',@name1)))>1">
  <br />
  (name0:
  <xsl:value-of select="@name0" />
  name1:
  <xsl:value-of select="@name1" />
  )
  <xsl:text>are duplicated.</xsl:text>
  <xsl:text>They are located in</xsl:text>
  <br />
  <xsl:apply-templates select="key('checkItem',concat(@name0,'::',@name1))"
/>
  <br />
  </xsl:if>
  </xsl:for-each>
  </xsl:template>
- <xsl:template match="row">
  Line
  <xsl:number />
- <xsl:if test="position()!=last()">
  <xsl:text>;</xsl:text>
  </xsl:if>
  </xsl:template>
  </xsl:stylesheet>

Cheers,

Sun-fu Yang
sfyang@xxxxxxxxxxxxx




 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.