[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Passing element nodes through string functions (WAS RE:
> In an attempt to see how the nodes are handled in your original version, I > added some numerical markers to the XSL: Using keys for grouping is known as "muenchian grouping" in hono(u)r of Steve Muench who thought of it (Jen's fault for coinng the phrase I believe) jenitennison.com has a good exposition of the technique, it's slightly obscured here as the node you are grouping on has to be split acros the groups as you really want to use the linebreak as the separator not the whole text string. But once youve mastered the technique overlapping the text splitting on to the muenchian grouping of the rest of the nodes is fairly routine, although you have to be careful as always about edge cases where there is only a text node, or no linebreaks etc to check the end conditions of the loops are right. This makes things verbose and probably harder to read than to write but that's xml for you:-) > Is the output that I have shown what you expect? yes (except for the first blank 1 line which may be a bug in my code, or it may be that your uinput really started with a linebreak? Ignoring that for now: First you group on line breaks and the (1) case is the string after the line break. so the first part of every div (after the first) is going to start with a (1) case, Then the (2) case just gets from the key all the nodes that follow this text node up to (and not including) the next text node that has a linebreak. so that's just the link element node in your case. you don't put out the next text node with cr (even though it is returned by the key because of the [position()<last()] (this is the extra bit over normal muenchian grouping) Then after that you need to get the part of the last text node up to teh cr, which is (3) David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ 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
|