2016-10-06 13 views
0

私は時刻表xmlとxslをやっていますが、xslは明らかに間違っていて、次のエラーが表示されています。 15行目のエラー9 - SXXP0003:XMLパーサーによってエラーが報告されました:一致する終了タグ "</ol>"で終了する必要があります。XML/XSL:終了タグが必要ですが、終了タグはそこにあります。エラーを続ける

XMLコードはここにある:http://textuploader.com/dabkb

XSLはこれです:

<xsl:template match="/"> 
    <html> 
     <head> 
      <title>Timetable Wage</title> 
     </head> 
     <body> 
      <h2>Print the names of all modules on the timetables</h2> 
       <ol> 
        <xsl:for-each select="/timetable/module"/> 
         <li><xsl:value-of select="name"/></li> 
        </xsl:for-each> 
       </ol> 


      <h2>Print the names of all modules which have an exam</h2> 
       <table border="1"> 
        <tr> 
         <th>Modules with exam</th> 
        </tr> 
        <xsl:for-each select="/timetable/module/exam/.."> 
         <tr> 
          <td><xsl: value-of select="name"/></td> 
         </tr> 
        </xsl:for-each> 
       </table> 

      <h2>Print name, day, time, room of all lab classes</h2> 
       <table border="1"> 
        <tr> 
         <th>Name</th> 
         <th>Day</th> 
         <th>Time</th> 
         <th>Room</th> 
        </tr> 
        <xsl:for-each select="/timetable/module/name|/timetable/module/classes/lab"> 
         <tr> 
          <td><xsl:value-of select="name"/></td> 
          <td><xsl:value-of select="day"/></td> 
          <td><xsl:value-of select="time"/></td> 
          <td><xsl:value-of select="room"/></td> 
         </tr> 
        </xsl:for-each> 
       </table> 

      <h2>Print the details of any module which has more than one lecture in a week</h2> 
       <table border="1"> 
        <tr> 
         <th>Name</th> 
         <th>Day</th> 
         <th>Time</th> 
         <th>Room</th> 
        </tr> 
        <xsl:for-each select="/timetable/module/classes/lecture[@id>0]|//name"> 
         <tr> 
          <td><xsl:value-of select="name"/></td> 
          <td><xsl:value-of select="day"/></td> 
          <td><xsl:value-of select="time"/></td> 
          <td><xsl:value-of select="room"/></td> 
         </tr> 
        </xsl:for-each> 
       </table> 

      <h2>Print the day, time and room of all classes which take place in computer labs</h2> 
       <table border="1"> 
        <tr> 
         <th>Day</th> 
         <th>Time</th> 
         <th>Room</th> 
        </tr> 
        <xsl:for-each select="//room[@type='computerLab']/..|//name"> 
         <tr> 
          <td><xsl:value-of select="day"/></td> 
          <td><xsl:value-of select="time"/></td> 
          <td><xsl:value-of select="room"/></td> 
         </tr> 
        </xsl:for-each> 
       </table> 

      <h2>Print the name of all modules which have classes on a Monday</h2> 
       <table border="1"> 
        <tr> 
         <th>Name</th> 
        </tr> 
        <xsl:for-each select="//day[text()='Mon']/..|//name"> 
         <tr> 
          <td><xsl:value-of select="name"/></td> 
         </tr> 
        </xsl:for-each> 
       </table>      
     </body> 
    </html> 
</xsl:template> 

+0

注:現時点では他のエラーを探しているわけではありません。 –

答えて

0

は、あなたのXSLTであなたのXMLレベルの構文エラーを排除するために...

   <xsl:for-each select="/timetable/module"> 

に変更

   <xsl:for-each select="/timetable/module"/> 

     <td><xsl: value-of select="name"/></td> 

     <td><xsl:value-of select="name"/></td> 

これらの修正を変更するだけで、あなたのXSLTは、よく形成されるようになるだろう。 (Your commentは現時点ではエラーを探していないことを示しています)

関連する問題