[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:

Subject: Re: Passing element nodes through string functions (WAS RE: Preserving inline elements when using string functions)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 28 Aug 2003 15:24:31 +0100
email through strings
> 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()&lt;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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.