Re: [xsl] Relationships in for-each statement

Subject: Re: [xsl] Relationships in for-each statement
From: "Bob Portnell" <simply.bobp@xxxxxxxxx>
Date: Fri, 8 Sep 2006 10:45:54 -0700
Nifty! Thanks very much for all the instruction and advice, and have a
fine, fine weekend.

Bob

On 9/8/06, David Carlisle <davidc@xxxxxxxxx> wrote:

> So, turning to elegance. Better to have that test inside the loop? Or > just ahead of, triggered by a test="exists(key('findTitle', blah, > blah))" ?

if I'm producing text or html or something I use the position()=1 method
(often as not). If I'm producing a proper structured xml nnested output
then you can't put the heading inside the loop as you need to do
something like

<xsl:if test="key(...)">
<section>
<head>...</head>
<xsl:for-each select="key(...)">
...
</xsl:for-each>
</section>
</xsl:if>


or since i see you're xslt2, you can often replace the whole shebang with


<xsl:for-each-group select="something" group-by="something else">
<section>
<head>...</head>
<xsl:for-each select="current-group()">
...
</xsl:for-each>
</section>
</xsl:for-each-group.

Current Thread