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">
<xslutput 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="//tempc[position()=1]" mode="Default"/>
</tr>
<xsl:apply-templates select="//temp:dk"
mode="notDefault"/>
</table>
</body>
</html>
</xsl:template>
<!-- ************************************* -->
<!-- ******************************************* -->
<xsl:template match="tempc[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="//tempc" mode="notDefault">
<!--xsl:for-each select="//tempc/*"-->
<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 ?
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">
<xslutput 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="//tempc[position()=1]" mode="Default"/>
</tr>
<xsl:apply-templates select="//temp:dk"
mode="notDefault"/>
</table>
</body>
</html>
</xsl:template>
<!-- ************************************* -->
<!-- ******************************************* -->
<xsl:template match="tempc[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="//tempc" mode="notDefault">
<!--xsl:for-each select="//tempc/*"-->
<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 ?