XML XSLT转换不能正确呈现表中的列

时间:2015-11-01 03:33:00

标签: html xml xslt

XML文件

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="try.xsl"?>
<q>
<student>
<Rollno>cs12b1006</Rollno>
<Name>Ajay</Name>
<Wtmarks> 80 </Wtmarks>
<Wtgrade> B </Wtgrade>
<Cdmarks> 80 </Cdmarks>
<Cdgrade> B </Cdgrade>
<Dcmarks> 80 </Dcmarks>
<Dcgrade> B </Dcgrade>
<Acamarks>80</Acamarks>
<Acagrade>B</Acagrade>
<Pcmarks>80</Pcmarks>
<Pcgrade>B</Pcgrade>
<IPmarks>80</IPmarks>
<IPgrade>B</IPgrade>
<GPA> ?</GPA>
<RESULT>?</RESULT>
<MEAN>?</MEAN>
<VARIANCE>?</VARIANCE>
<SD>?</SD>
</student>
<student>
<Rollno>cs12b1001</Rollno>
<Name>krishna</Name>
<Wtmarks> 80 </Wtmarks>
<Wtgrade> B </Wtgrade>
<Cdmarks> 80 </Cdmarks>
<Cdgrade> B </Cdgrade>
<Dcmarks> 80 </Dcmarks>
<Dcgrade> B </Dcgrade>
<Acamarks>80</Acamarks>
<Acagrade>B</Acagrade>
<Pcmarks>80</Pcmarks>
<Pcgrade>B</Pcgrade>
<IPmarks>80</IPmarks>
<IPgrade>B</IPgrade>
<GPA> ?</GPA>
<RESULT>?</RESULT>
<MEAN>?</MEAN>
<VARIANCE>?</VARIANCE>
<SD>?</SD>
</student>
</q>

XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:t="http://www.test.com        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Grades</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Rollno</th>
  <th>Name</th>
      <th>Wtmarks</th>
      <th>Wtgrade</th>
      <th>Cdmarks</th>
      <th>Cdgrade</th>
      <th>Dcmarks</th>
      <th>Dcgrade</th>
      <th>Acamarks</th>
      <th>Acagrade</th>
      <th>Pcmarks</th>
      <th>Pcgrade</th>
      <th>IPmarks</th>
      <th>IPgrade</th>
      <th>GPA</th>
      <th>RESULT</th>
      <th>MEAN</th>
      <th>variance</th>
      <th>SD</th>
 </tr>
 <xsl:for-each select="q/student">
 <tr>
     <td><xsl:value-of select="Rollno"/></td>
     <td><xsl:value-of select="Name"/></td>
         <td><xsl:value-of select="Wtmarks"/></td>
         <td><xsl:value-of select="Wtgrade"/></td>
             <td><xsl:value-of select="Dcmarks"/></td>
             <td><xsl:value-of select="Dcgrade"/></td>
             <td><xsl:value-of select="Acamarks"/></td>
     <td><xsl:value-of select="Acagrade"/></td>         
     <td><xsl:value-of select="Pcmarks"/></td>
     <td><xsl:value-of select="Pcgrade"/></td>                
     <td><xsl:value-of select="IPmarks" disable-output-escaping="yes"/></td>        
     <td><xsl:value-of select="IPgrade"/></td>                         
     <td><xsl:value-of select="GPA"/></td>        
     <td><xsl:value-of select="RESULT"/></td>        
     <td><xsl:value-of select="MEAN"/></td>        
     <td><xsl:value-of select="VARIANCE"/></td>        
     <td><xsl:value-of select="SD"/></td>                         
</tr>
</xsl:for-each>
</table>
 </body>
 </html>
 </xsl:template>

 </xsl:stylesheet> 

Click here to see the browser output

我正在尝试使用XSLT进行基本的XML转换。但遗憾的是,缺少IPmarks和IPgrade列,右侧的其他列已合并到这些列中。

为什么不显示IPmarks和IPgrade列?

0 个答案:

没有答案