|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Displaying every 2 element values in 1 rowy
> How can I display every two element node values in one row by checking the
> position?
>
> If I have an xml like:
>
> <eno>A21</eno>
> <eno>A22</eno>
> <eno>A23</eno>
> <eno>A24</eno>
> <eno>A25</eno>
> <eno>A26</eno>
<!-- look at every 1st, 3rd, 5th, etc 'eno' element child of current node -->
<xsl:for-each select="eno[position() mod 2 = 1]">
<!-- start a new table row -->
<tr>
<!-- cell 1: value of current 'eno' -->
<td>
<xsl:value-of select="."/>
</td>
<!-- cell 2: value of next 'eno' or a non-breaking space if none -->
<td>
<xsl:choose>
<xsl:when test="following-sibling::eno">
<xsl:value-of select="following-sibling::eno"/>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</td>
</tr>
</xsl:for-each>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








