[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

mixed content grouping by whitespace

Subject: mixed content grouping by whitespace
From: James Cummings <james+xsl@xxxxxxxxxxxxxxxxx>
Date: Sun, 11 Apr 2010 17:37:52 +0100
 mixed content grouping by whitespace
Hi there,

I've been playing with some mixed content grouping by whitespace.B  I
have an input like:

====
<ab xmlns="http://www.tei-c.org/ns/1.0">
B B B  <seg>foo blort wibble</seg><lb/>
B B B  <seg>foo-<m>blort</m> wibble</seg><lb/>
B B B  <seg><w>foo</w>-<m>blort</m> wibble</seg><lb/>
</ab>
====

and what I want as an output is to group any whitespace separated bits
of content with <w> elements, including existed child <w> and <m>

====
<ab xmlns="http://www.tei-c.org/ns/1.0">
B B B  <seg><w>foo</w> <w>blort</w> <w>wibble</w></seg><lb/>
B B B  <seg><w>foo-<m>blort</m></w> <w>wibble</w></seg><lb/>
B B B  <seg><w><w>foo</w>-<m>blort</
m></w> <w>wibble</w></seg><lb/>
</ab>
====

Currently I'm doing something like:
====
<xsl:for-each-group select="tei:m|tei:w|text()" group-starting-with="text()">
B B B B B B B  <w>
B B B B B B B  <xsl:apply-templates select="current-group()"/>
B B B B B B B  </w>
B B B  </xsl:for-each-group>
====

Which, as one would expect does things like
<w><w>foo</w></w><w>-<m>blort</m></w> when I would want
<w><w>foo</w>-<m>blort</m></w>.B  This, of course, completely
understandable since that is what I'm asking it to do by
group-starting-with="text()".

Suggestions?

-James

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.