Subject: [xsl] Filter nodes by attribute and output disgarded dups From: Mike Ferrando <mikeferrando@xxxxxxxxx> Date: Mon, 7 Jan 2002 08:20:46 -0800 (PST) |
Friends, I am attempting to pull node data conditioned by the attribute value. <PERSNAME ROLE="arr">Smith, John</PERSNAME> I am having trouble writing the syntax. The reason is that I am not sure how the syntax is delimited. I keep getting parsing errors "Unexpected token". I take it that I cannot have "[]" followed by "()". How can I write this using an attribute in the expression? What I would like to do is: 1. sort by name of arranger. 2. filter out the duplicates 3. capture the number of duplicates 4. output each name and the number of times it appears Here is my xml and my xsl: <C02> <DID> <UNITTITLE> <PERSNAME ENCODINGANALOG="100$a">Abt, Franz</PERSNAME> </UNITTITLE> </DID> <C03> <DID> <CONTAINER TYPE="BOX">22</CONTAINER> <UNITTITLE ID="PV106"> <TITLE>Schalf wohl, du süsser Engel du, op. 139</TITLE> <PERSNAME ENCODINGANALOG="700$a" ROLE="arr">Hennes, Aloys</PERSNAME> <GEOGNAME ENCODINGANALOG="260$a">London</GEOGNAME> <CORPNAME ENCODINGANALOG="260$b">Ent. Stat Hall</CORPNAME> <UNITDATE ENCODINGANALOG="260$c">[n.d.]</UNITDATE> </UNITTITLE> </DID> <ODD> <P> <SUBJECT>For piano</SUBJECT> </P> </ODD> </C03> </C02> Here is my xsl attempts: <xsl:for-each select="//C03//PERSNAME[@ROLE='arr'](not[.=preceding::PERSNAME])"> <xsl:sort select="."/> <LI><xsl:value-of select="."/> <xsl:text>     : </xsl:text> <xsl:value-of select="count(.//PERSNAME[@ROLE='arr'])"/> </LI> </xsl:for-each> Thanks, Mike F. __________________________________________________ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: distinct moves problem, Dimitre Novatchev | Thread | Re: [xsl] Filter nodes by attribute, Joerg Heinicke |
RE: [xsl] is document('') mandatory, Michael Kay | Date | Re: XPath's role (Was: Re: [xsl] Re, Jeni Tennison |
Month |