Hi David,
Thanks for your explanation.
If I understood well, in my sample :
<span class="bar">text4</span>
<span class="bar">text5</span>
The 2 spans elements would not have been considered adjacent beacause
the indentation "create" (or "is") a (whitespace) text node inbetween.
Actually, in my xhtml doc, spans are sometimes inline, sometimes not,
and there might be spaces between them when inline.
In xhtml spaces are important, i think you all now the rules : only one
space is displayed even when there are more, and a line feed also
generate one space on the display screen.
So to be more generic and xhtml indentation/spaces aware, i would like
such an input :
<p id="foo"><span class="foo1">text1</span> <span class="foo1">text2</span>
<span class="foo1">text3</span> <span class="foo2">text4</span> <span
class="foo2">text5</span>
<span class="foo2">text6</span><span class="foo1">text7</span> <span
class="foo1">text8</span>
</p>
to be output like this :
<p id="foo"><span class="foo1">text1 text2 text3</span> <span
class="foo2">text4 text5 text6</span><span class="foo1">text7 text8</span>
</p>
I tried the same template as you David, with :
<xsl:for-each-group select="node()" group-adjacent="string(@class) or
normalize-space(.)=' '">
which doesn't group anything from my sample above.
string(@class) is a string whereas normalize-space(.)=' ' is a
boolean... so my test isn't good?
I'm searching for a solution, any suggestions are welcome !
Matt
Le 20/12/2010 21:40, David Carlisle a écrit :
On 20/12/2010 17:47, Matthieu Ricaud-Dussarget wrote:
what about text()[normalize-space()], i never seen such a predicate,
does the normalized-text directly ?
in your sample answer you considered two spans with the same class as
adjacent if they were separated by white space.
select="node()" group-adjacent="string(@class)"
would not have considered them adjacent.
so rather than select=node() I used
select="text()[normalize-space()]|* which selects just non-white text
nodes and elements. In the sequence selected by that expression, the
spans with the same class are adjacent as the indentation is not selected
David
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--
Matthieu Ricaud
IGS-CP
Service Livre numérique
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--