|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Newbie question - Muenchian method and XPath
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








