My document is :
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="university_style.xsl"?>
<!DOCTYPE library SYSTEM "validator.dtd">
<university>
<total_faculty>13</total_faculty>
<faculty>
<id>1</id>
<name>name 1</name>
<total_chairs>9</total_chairs>
<chairs_list>
<chair>name 1</chair>
<chair>name 2</chair>
<chair>name 3</chair>
...
</chairs_list>
</faculty>
</university>
and xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:template match="/">
<html>
<body>
<table border="1" cellpadding="4" cellspacing="0">
<caption>total_faculty:<xsl:value-of select="university/total_faculty"/></caption>
<tr bgcolor="#999999" align="center">
<th>id</th>
<th>name</th>
<th>total chairs</th>
<th>chairs</th>
</tr>
<xsl:for-each select="university/faculty">
<tr>
<td>
<xsl:value-of select="id"/>
</td>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="total_chairs"/>
</td>
<td>
<!--<p><xsl:value-of select="chairs_list"/></p> -->
<xsl:for-each select="chairs_list">
<p><xsl:value-of select="chair"/> </p>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I want to show all elements from in new row. But i see either first element or all. If a use then all list in one row.
If i use:
<xsl:for-each select="chairs_list">
<p><xsl:value-of select="chair"/> </p>
</xsl:for-each>
I see just first element of list. How to solve it ? :)
No comments:
Post a Comment