Re: Seeking help on Grouping distingt sub-elements
Hi Jim, > Having looked at Ken's, Jeni's was a bit more aproachable (still a > little wierded out by the key thing after the recent > head-bashing...) - it appears that they're doing the exactly the > same thing - Ken's is using a for-each immediately followed by an if > that compares the generate-id values, while Jeni's uses a for-each > with the equivalent key-based approach - is that correct? That's right. Ken's method iterates over all the elements, stores the 'current group' in a variable, and then tests whether the element is the first of that current group. The method I demonstrated puts together the node set of elements that are the first of its group, and iterates over those. It's more compact, but more difficult to understand (unless you're used to it!). It has another advantage -- you can number the groups that you create sequentially, which isn't possible with the method Ken showed you. But that's not required for your situation anyway. > Jeni, in yours, I've not seen the "parent::shipment" style use of > the parent axis previously - I've only ever seen it used as ".." or > "parent::node()" - it appears that "parent::shipment" is equivalent > to "parent::node()" is equivalent to "..", as I put one of each in > (ie, mixed and matched) and everything went file. Is > "parent::shipment" just a very clear method of saying "I know that > shipment is the parent of my current node"? I presume that things > would be more flexible using ".." or "parent::node()" vs > "parent::shipment", such as if the <shipment> node were to change > name, but the remaining structure stayed the same? That's right. I used parent::shipment to make it clear that I was generating the ID of the parent 'shipment' element, that's all. It's equivalent to '..' if the parent of the context element is a 'shipment' element. > I like the simplicity and clearness of Ken's method, but like the > compactness of Jeni's. What did you think of the XSLT 2.0 method? Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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