please help in creating a dynamic table

E

Ex-Em-El

I have a problem in creating a dynamic table
in the same xml :

1.xml:

<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="2.xsl"?>
<aaa xmlns="http://tempuri.org/My.xsd">
<ppp>
<po>
<co>c</co>
<do>int</do>
<we>1</we>
</po>
</ppp>
<bbb>
<bn>
<yu>20</yu>
<gh>1</gh>
<c1>6</c1>
<c2>6</c2>
<c3>6</c3>
</bn>
</bbb>
<fy>
<pc>
<dk>
<er>1</er>
<c1>2</c1>
<c2>6</c2>
<c3>3</c3>
</dk>
<dk>
<er>1</er>
<c1>5</c1>
<c2>2</c2>
<c3>3</c3>
</dk>
</pc>
<pc>
<dk>
<er>2</er>
<c1>2</c1>
<c2>2</c2>
<c3>8</c3>
</dk>
<dk>
<er>2</er>
<c1>2</c1>
<c2>2</c2>
<c3>0</c3>
</dk>
</pc>
</fy>
</aaa>

and i have this xsl :

2.xsl :


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:temp="http://tempuri.org/My.xsd">
<xsl:eek:utput method="html" encoding="Windows-1252"/>
<xsl:template match="/">
<html>
<body>

<H2>
<font color="#3399CC">
<center>Project</center>
</font>
</H2>
<!-- ******************************************* -->
<table Width="100%" BORDER="1" CELLPADDING="5">
<tr>
<xsl:apply-templates
select="//temp:pc[position()=1]" mode="Default"/>
</tr>
<xsl:apply-templates select="//temp:dk"
mode="notDefault"/>
</table>
</body>
</html>
</xsl:template>
<!-- ************************************* -->

<!-- ******************************************* -->
<xsl:template match="temp:pc[position()=1]" mode="Default">
<xsl:for-each select="temp:dk[position()=1]/*">
<th>
<font color="#3399FF">
<xsl:value-of select="name()"/>
</font>
</th>
</xsl:for-each>
<br/>
<br/>
</xsl:template>
<!-- ********************************** -->
<xsl:template match="temp:dk[position()=1]" mode="Default">
<xsl:apply-templates/>
</xsl:template>
<!-- *************************** -->
<xsl:template match="//temp:pc" mode="notDefault">
<!--xsl:for-each select="//temp:pc/*"-->
<xsl:apply-templates select="//temp:dk" mode="notDefault"/>
<!--/xsl:for-each-->
</xsl:template>
<!-- **************************************************** -->
<xsl:template match="temp:dk" mode="notDefault">
<tr>
<xsl:for-each select="//temp:dk/*">

<td>
<xsl:value-of select="current()"/>
</td>

</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>

i want a table that every <dk> node will be in one line.
the first <dk> node in the first line, the second <dk> node will be in
the second line .... an so on

can you pleas tell me way do i get a different results then i seek ?
and can you tell me how can i fix it ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,828
Latest member
LauraCastr

Latest Threads

Top