Subject: Re: [xsl] variable as element name; issues with for-each-group From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 11 Jul 2007 17:22:45 +0100 |
<xsl:for-each-group group-starting-with="chapter" select="*"> <chapter> ... with group-starting-with any items occurring before the first matching element become the first group, so if you want to lose that you can either not select them or filter tham out afterwards <xsl:for-each-group group-starting-with="chapter" select="chapter[1]|chapter[1]/following-sibling::*"> <chapter> ... or <xsl:for-each-group group-starting-with="chapter" select="*"> <xsl:if test="self::chapter"> <chapter> ... <family name="{current-group()[1]}"> That is the same as <family name="{.}"> as the first item in the current group is always teh current item in this context. so for groups beginning with chapter (all the ones you want) this should be "1" "2" etc. looking at your input don't you want something like <family name="{family/name} > superfamily[1]/position() position() will always be 1 there as superfamily[1] selects a sequence of one item, so that item will have position()=last()=1. position() never relates to the position of an item in the input, only to the position in the currently seelcted sequence. ] David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] variable as element name; iss, Thomas Kielczewski | Thread | RE: [xsl] variable as element name;, Michael Kay |
[xsl] variable as element name; iss, Thomas Kielczewski | Date | RE: [xsl] variable as element name;, Michael Kay |
Month |