xsl-list
[Top] [All Lists]

Re: [xsl] RE: loop elements based on attribute

2008-08-15 08:16:29
Kjellaug Johansen wrote:

In an xslt-file I use templates for each match on different elements.
When I reach a Pkt-element I call the template "pktTemplate". How can I
get the right result? I'm almost there...but the problem is that the
first Pkt-element that matches (where the template-call is done) is
never listed in the result. But the siblings are listed at the right
way.

<xsl:template name="pktTemplate">
<xsl:if test="not(preceding-sibling::*[1][self::Pkt])"> <List> <xsl:for-each-group
select="following-sibling::Pkt
                         [preceding-sibling::*[1][self::Pkt]][generate-
id(preceding-sibling::Pkt[not(preceding-
sibling::*[1][self::Pkt])][1])= generate-
id(current())]" group-starting-with="Pkt[not(@type =
'uavs')]">                                              

Well you only process the following siblings above. So perhaps you want
 <xsl:for-each-group
   select=". | following-sibling::Pkt
                         [preceding-sibling::*[1][self::Pkt]][generate-
id(preceding-sibling::Pkt[not(preceding-
sibling::*[1][self::Pkt])][1])= generate-
id(current())]" group-starting-with="Pkt[not(@type =
'uavs')]">      

That is just a guess however.


--

        Martin Honnen
        http://JavaScript.FAQTs.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>