xsl-list
[Top] [All Lists]

Re: [xsl] nested grouping problem

2010-10-04 13:54:06
Thanks again for explanation, David. For some reason I think only of placing 
punctuation _after_ an item not before. If I had only read the template, I 
would have understood what you are doing. And thanks for the optimization tip. 

Terry
On Oct 4, 2010, at 2:39 PM, David Carlisle wrote:

On 04/10/2010 18:48, Terry Ofner wrote:
I am mystified as to how the<xsl:if test="position()!=1">;</xsl:if>
knows to put the semicolon after every grouped @main item except the
last one.

it doesn't:-)

it puts a semicolon _in front_ of every item except the first.

Incidentally I think I saw somewhere Michael commenting that for long 
sequences

<xsl:for-each select=....>
<xsl:if test=position()!=1>,</xsl:if>
<foo/>
</xsl:for-each>

is more efficient (or at least more easily streamed, or something) than the 
otherwise equivalent


<xsl:for-each select=....>
<foo/>
<xsl:if test=position()!=last()>,</xsl:if>
</xsl:for-each>


as in the first case you can start outputting straight away but the last case 
you need either to delay until you know last() (ie the length of the 
sequence) or you have an optimiser smart enough to know you don't really need 
to know the value of last() just that ther eis another one coming up....


David


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