[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: mixed content grouping by whitespace
On Mon, Apr 12, 2010 at 12:34, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: > They do, the end result is the same. B But I perceived what I was doing as > preserving the text as a text node and then copying the text node. B Asking > for the value of an element does a recursive descent below the element > looking for all text nodes. B Sure there is only one, so it isn't going to go > far. B But the philosophy of taking the value of an element to me was > different than simply copying that text node I created to preserve the > white-space. B I wrote it to support the way I was thinking about it. I suppose that makes sense. I wonder if that is also more efficient for the processor as well. >> This works because >> you're doing group-starting-with() so you know the first thing in the >> group is the my:text node. > The first thing *may* be a my:text node. B All of the lines don't start with > white-space, so all of the lines will start with a group without a my:text > element. B Remember that in the start of a group the current node is the > first member of the group. B Which is why I'm using the self:: axis to ensure > that I'm only copying the nodes of the first of the group if the first of > the group is a my:text element. Yes, it is that this is really a conditional copy-of that wasn't apparent to me at the start. I.e. that because there is self::my:text/node() it will only copy if the first member of the group (which is the context node inside for-each-group) is a my:text node. For a moment I had some unease about whether only having this at the start (before the <w>) meant I was somehow missing a my:text from the end, but of course, since it is 'group-starting-with' that is not the case, as if it was there it would be a new group. > People gripe about namespaces but note how I was able to use my own > namespace to add unambiguously my own information to the old information. No, I like namespaces. They are a difficult sell to some of the TEI community, but entirely necessary and wonderful. Though I would have (like Gerrit) just done it still in the TEI namespace since I was getting rid of it afterwards, I understand the benefit of clarity that doing it in a separate namespace provides. >> These things are B starting to make my brain melt less than previously, >> which is a start I guess. > Good! B Grouping is a very powerful tool in XSLT 2.0. Oh yes, I know that. It is in my top 3 things I like in XSLT2 Everytime I post here at the moment it seems to be grouping-related (or analyze-string/regex). I've started looking at other problems in life as just really grouping problems. ;-) -James
|
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
|