xsl-list
[Top] [All Lists]

Re: [xsl] group together subsequent elements?

2012-03-17 06:12:24
Matěj Cepl wrote:

I am probably missing something very obvious, but I have not found a way
how to combine group of same elements into one. Meaning, I have on input

n.: <spoj>mám</spoj> <spoj>zalíbení</spoj>

and I would like to get on output

n.: <linked>mám zalíbení</linked>

(number of elements in one group can vary).

Do I miss something completely trivial or it is one of those things
which XSLT cannot do?

I am sure there are easy solutions with XSLT 2.0 and for-each-group but without seeing more context it is hard to say whether you simply want
  <xsl:for-each-group select="*" group-by="node-name(.)">
or
  <xsl:for-each-group select="*" group-adjacent="node-name(.)">
So show us more context, like the parent element of those "spoj" elements, what kind of sibling elements there are, how the expected output looks with those siblings included.

--

        Martin Honnen --- MVP Data Platform Development
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
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>
--~--