Subject: [xsl] ReRe: in for-each apply-templates doesnot work From: "Yang" <sfyang@xxxxxxxxxxxxx> Date: Thu, 20 Sep 2001 14:50:55 +0800 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] FW: How to realize docume, Kumar, Yaswanth | Thread | Re: [xsl]in for-each: absolut posit, Jochen Herrmann |
[xsl] FW: How to realize document(), Kumar, Yaswanth | Date | [xsl] Re:FW: How to realize documen, Yang |
Month |