This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

AW: adressing attributes


ok, I found it myself...

<xsl:choose>
	<xsl:when test="../element[$here+$half]">
	<xsl:for-each select="../element[$here+$half]">
		<xsl:value-of select="@id"/>
	</xsl:for-each>
	</xsl:when>
	<xsl:otherwise></xsl:otherwise>
</xsl:choose>	

-----Ursprüngliche Nachricht-----
Von: Michael Zehrer [mailto:zehrer@optimal-systems.de]
Gesendet: Freitag, 29. Juni 2001 12:31
An: xsl-list@lists.mulberrytech.com
Betreff: [xsl] adressing attributes


Thanks to the FAQ I learned howto "Making balanced two-column tables from
one-column data", but I also want to list one attribute and really don't
know how to address it. 

This is my XML:

<page>
	<element id="sometext">content</element>
	...
</page>

and my XSL is:

<xsl:variable name="t-size" select="count(//element)"/>
<xsl:variable name="half" select="ceiling($t-size div 2)"/>
		   
<table>
	<xsl:for-each select="//element[position() &lt;= $half]">
	<xsl:variable name="here" select="position()"/>
	<tr>
	<td><xsl:value-of select="@id"/></td>
	<td><xsl:value-of select="."/></td>
	<td><xsl:value-of select="@id"/></td>
	<td>
	<xsl:choose>
		<xsl:when test="../element[$here+$half]">
			<xsl:value-of select="../element[$here+$half]"/>
		</xsl:when>
		<xsl:otherwise></xsl:otherwise>
	</xsl:choose>
	</td>
	</tr>
	</xsl:for-each>
</table>

Sure, at the moment the @id in the 3rd cell gives the same value as the one
in the first cell, but it should contain the value of the id attribute of
the 4th cell element. I tried to construct something similar to the 4th cell
xsl code, but it just don't work. Can someone explain it to me?

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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]