xsl-list
[Top] [All Lists]

Re: Grouping problem

2005-08-01 01:35:44
Hi Mukul,

Bizare, isn't it, how you can solve hundreds of problems instantaneously and 
then stumble apon a simple situation that behaves completely unexpectedly;)

Tempore 08:56:50, die 08/01/2005 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Mukul Gandhi 
<gandhi(_dot_)mukul(_at_)gmail(_dot_)com>:

I am trying to do grouping operation with the following XSL -
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        
        <xsl:template match="/root">
           <groups>
             <xsl:for-each select="*[not(name() = name(preceding-sibling::*))]">
            <group name="{name()}" />
             </xsl:for-each>
           </groups>
        </xsl:template>
        
</xsl:stylesheet>

The 'name()' function takes only the first node when it's argument is a 
node-set.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant

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