This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Elements of non-actual position
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 04 Jun 2002 21:54:38 +0200
- Subject: Re: [xsl] Elements of non-actual position
- References: <LDEIKGFFDCPAMKPBIOKHCEPHCLAA.rudolf.pischek@asei.cz>
- Reply-to: xsl-list at lists dot mulberrytech dot com
<xsl:template match="table/rows">
<xsl:for-each select="row">
<xsl:variable name="pos" select="position()"/>
<xsl:if test="/table/cols/col[$pos]/@visible = '1'">
do what you want
</xsl:if>
</xsl:for-each>
</xsl:template>
Regards,
Joerg
Rudolf Pischek wrote:
Hi,
I have a problem of searching in my XML data:
<table>
<cols>
<col visible="1"/>
<col visible="1"/>
<col visible="1"/>
<col visible="0"/>
<col visible="1"/>
<col visible="1"/>
<col visible="0"/>
</cols>
<rows>
<row>
<cell>1</cell>
<cell>2</cell>
<cell>3</cell>
<cell>4</cell>
<cell>5</cell>
<cell>6</cell>
<cell>7</cell>
</row>
<row>
...
</row>
...
</rows>
</table>
and if I have a template:
<xsl:template match="table/rows">
<!-- and I want in for-each: Give me all elements cell which position is the same as the position of elements cols which attribute visible is 1 -->
<xsl:for-each="...">
<!-- than this for-each must contain: cell 1, cell 2, cell 3, cell 5, cell 6 -->
</xsl:for-each>
</xsl:template>
I have no idea how I can get elements, one element I can...
Thanks very much
Rudolf
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list