xsl-list
[Top] [All Lists]

RE: Problems grouping adjacent siblings

2005-06-30 10:01:27

I would like to group adjacent siblings which share the same 
local-name
into a container element.

I thought that this would be the classical use-case for an
<xsl:for-each-group> with @group-adjacent, but I am getting the
strangest results...

I can't tell what you are doing wrong without seeing your code.

With ax as the context node, you can do

<xsl:for-each-group select="*" group-adjacent="local-name()">
  <xsl:choose>
    <xsl:when test="current-grouping-key()='ex'">
      <remark><xsl:copy-of select="current-group()"/></remark>
    </
    <xsl:otherwise>
      <xsl:copy-of select="current-group()"/>
    </
  </
</

Michael Kay
http://www.saxonica.com/ 



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



<Prev in Thread] Current Thread [Next in Thread>