Help getting the difference of two attribute lists
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Hi, I have two lists of attributes ($attr1, $attr2). I want to make a list ($attr3) that will be everything found in $attr1 and NOT in $attr2. example: doc1.xml: <attr1 a=5 b=6 c=7/> <attr2 c=7 b=6/> Running this code: <xsl:variable name="attr1" select="attr1\@*"/> <xsl:variable name="attr2" select="attr2\@*"/> Returns this: $attr1[0] = 'a' 5 $attr1[1] = 'b' 6 $attr1[2] = 'c' 7 $attr2[0] = 'c' 7 // Notice that its not ordered $attr2[1] = 'b' 6 What I would like to get in attr3 is this: $attr3[0] = 'a' 5 <- in attr1 and NOT in attr2 I looked around, and found some formula, that didnt work $attr1[count(.|$attr2)=count($attr2)].. <xsl:variable name="attr3" select="$attr1[count(.|$attr2)=count($attr2)]"/> attr3 came out empty.. If you have anything that might help me, please let me know, iam quite lost..