Hi,
Sorry, I'm relatively new to XSLT - so it's another Muenchian Method/XPath
query I'm afraid!
I have an XML file, similar to... (obviously this isn't my real data, nor
real tag names...)
<group value="1">
<item type="a" name="apple" />
<item type="a" name="banana" />
<item type="c" name="carrot" />
</group>
<group value="2">
<item type="b" name="some" />
<item type="c" name="random" />
<item type="c" name="words" />
</group>
... and yes, I want to do grouping with XSLT 1.0.
I'm using an <xsl:template match="group"> and then the code from Jeni's page
(http://www.jenitennison.com/xslt/grouping/muenchian.html) in there, but the
output is sort of like:
"Group 1
========
a - apple, banana
c - carrot, random, words
Group 2
========
b - some"
So it's dragging all <item>s together (as xsl:key is obviously document wide
and I can't use scope)., which isn't what I want! (I want:
"Group 1
==========
a - apple, banana
c - carrot
Group 2
========
b - some
c - random, words"
I've tried amending one line of the solution to:
<xsl:for-each select="item[(../@value='1') and (count(. | key('mykey',
@type)[1]) = 1)]">
just to see if I can get ONLY results for group 1 which are meant to be in
group 1, but even this isn't working...
I presume I've just been a bit naive with my XPath expression - could anyone
explain how best to tackle this?
Many thanks,
Chris
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--