Re: mixed content grouping by whitespace
On Mon, Apr 12, 2010 at 01:19, G. Ken Holman <gkholman@xxxxxxxxxxxxxxxxxxxx> wrote: > When I completed my solution I found it almost identical to yours, except > that I used group-starting-with=. B I also could not think of a way to do it > in one pass. It seems that when the solution requires a two pass one done all in one stylesheet, I have difficulty getting my head around it. From what I can see yours is basically similar to Gerrit's but uses an element in a my: namespace. You group starting with my:text (which surrounds the whitespace)... > B B <xsl:for-each-group select="$content" > B B B B B B B B B B B B group-starting-with="my:text"> > B B B <xsl:copy-of select="self::my:text/node()"/> > B B B <w> > B B B B <xsl:copy-of select="current-group()[not(self::my:text)]"/> > B B B </w> > B B </xsl:for-each-group> Where Gerrit took the value of current-group when the current-grouping-key was a true boolean, you do a copy-of but then select the nodes inside the self::my:text .... that confused me for a bit and I'm not sure I don't see why you don't just do <xsl:value-of select="self::my:text"/> (hrmm, that I say 'just' here is probably unfair, they both work out as the same thing.) This works because you're doing group-starting-with() so you know the first thing in the group is the my:text node. These things are starting to make my brain melt less than previously, which is a start I guess. Many thanks! -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