xsl-list
[Top] [All Lists]

AW: Problems grouping adjacent siblings

2005-06-30 01:57:17
Hi

With the help of a colleague, I managed to get a working solution.

<xsl:template match="*[exp]">
   <xsl:copy>
      <xsl:for-each-group select="*" group-adjacent="if (self::exp) then 
'remark' else 'other'">
        <xsl:choose>
           <xsl:when test="current-grouping-key() = 'other'">
              <xsl:copy-of select="current-group()"/>
           </xsl:when>
           <xsl:otherwise>
              <xsl:element name="{current-grouping-key()}">
                 <xsl:copy-of select="current-group()"/>
              </xsl:element>
           </xsl:otherwise>
        </xsl:choose>
         </xsl:for-each-group>
      </xsl:copy>
   </xsl:template>

Thanks for the help!

wbr,
Roman

-----Ursprüngliche Nachricht-----
Von: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk] 
Gesendet: Donnerstag, 30. Juni 2005 10:39
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: [xsl] Problems grouping adjacent siblings


You want to use group-adjacent, grouping on name() no need to 
use the sibling axis explictly here.

David

______________________________________________________________
__________
This e-mail has been scanned for all viruses by Star. The 
service is powered by MessageLabs. For more information on a 
proactive anti-virus service working around the clock, around 
the globe, visit:
http://www.star.net.uk
______________________________________________________________
__________

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



--~------------------------------------------------------------------
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>
  • AW: Problems grouping adjacent siblings, Huditsch Roman <=