xsl-list
[Top] [All Lists]

Re: Struggling with tables

2002-10-15 06:47:09
Hi Vic,

<xsl:for-each select="item[position() mod 5 = 1]">
<tr>
  <xsl:apply-templates
     select=".|following-sibling::item[position() < 5]"/>
</tr>
<xsl:for-each>

My problem is the xml I've been given. The elements at this level
all have different names, so how can I rephrase the above loop to
work with this xml? Something like <xsl:apply-templates
select=".|following-sibling::A1 or A2 or A3 or A4 (etc)[position() <
5]"/>

You *could* specify each of the names as follows:

  . | following-sibling::*[self::A1 or self::A2 or self::A3 ...]
        [position() < 5]

but probably you don't need to test the names at all; just use:

  . | following-sibling::*[position() < 5]

(Note that you have to escape the < to &lt; when you use this
expression within the XSLT.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>