2016-12-02 8 views
0

私はイントロプログラミングクラスのプロジェクトに取り組んでいます。私は、XSLドキュメントを使用して私の学校書店で本のリストを表示するXMLドキュメントを書く必要があります。クラスプロジェクトのXML/XSLTヘルプ

私はほとんど完了しましたが、私のページを投稿しようとすると、ドキュメントに余分な内容に関するエラーが表示されます。私はどこからエラーが来るのか分からない。ここ

<?xml version="1.0" encoding="UTF-8"?> 
<bookstore> 
    <book> 
    <ISBN>32132132132</ISBN> 
    <BookTitle>Peace Corps</BookTitle> 
    <Author>Jack and Angene Wilson</Author> 
    <InStock>50</InStock> 
    <SellingPrice>15.00</SellingPrice> 
    <CostPrice>12.00</CostPrice> 
    <PublicationYear>2011</PublicationYear> 
    <Publisher>City Publications</Publisher> 
    </book> 
<bookstore> 
    <book> 
    <ISBN>97942335221</ISBN> 
    <BookTitle>Fundamentals of Database Systems</BookTitle> 
    <Author>Ramez Elmasri</Author> 
    <InStock>100</InStock> 
    <SellingPrice>125.00</SellingPrice> 
    <CostPrice>100.00</CostPrice> 
    <PublicationYear>2011</PublicationYear> 
    <Publisher>Addison-Wesley</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>64814414414</ISBN> 
    <BookTitle>Legal Issues of Computer Security</BookTitle> 
    <Author>Joanna Gramma</Author> 
    <InStock>20</InStock> 
    <SellingPrice>60.00</SellingPrice> 
    <CostPrice>55.00</CostPrice> 
    <PublicationYear>2012</PublicationYear> 
    <Publisher>Jones and Bartlett</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>9780133862256</ISBN> 
    <BookTitle>Starting Out with Python 3rd Ed</BookTitle> 
    <Author>Tony Gaddis</Author> 
    <InStock>80</InStock> 
    <SellingPrice>194.75</SellingPrice> 
    <CostPrice>160.00</CostPrice> 
    <PublicationYear>2015</PublicationYear> 
    <Publisher>Pearson</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>12345678901</ISBN> 
    <BookTitle>Discrete Mathematics</BookTitle> 
    <Author>Kenneth Rosen</Author> 
    <InStock>200</InStock> 
    <SellingPrice>212.69</SellingPrice> 
    <CostPrice>175.00</CostPrice> 
    <PublicationYear>2012</PublicationYear> 
    <Publisher>McGraw-Hill</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>44444444444</ISBN> 
    <BookTitle>Visual Basic: Step by Step</BookTitle> 
    <Author>Malik</Author> 
    <InStock>100</InStock> 
    <SellingPrice>38.75</SellingPrice> 
    <CostPrice>35.00</CostPrice> 
    <PublicationYear>2007</PublicationYear> 
    <Publisher>Course Technology</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>2900133775982</ISBN> 
    <BookTitle>Programming the WWW 8th Ed</BookTitle> 
    <Author>Robert W. Sebesta</Author> 
    <InStock>60</InStock> 
    <SellingPrice>34.80</SellingPrice> 
    <CostPrice>150.00</CostPrice> 
    <PublicationYear>2014</PublicationYear> 
    <Publisher>Pearson</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>98013200025</ISBN> 
    <BookTitle>Cryptography</BookTitle> 
    <Author>Stinson</Author> 
    <InStock>10</InStock> 
    <SellingPrice>105.00</SellingPrice> 
    <CostPrice>75.00</CostPrice> 
    <PublicationYear>2008</PublicationYear> 
    <Publisher>CRC</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>27224421166</ISBN> 
    <BookTitle>C++ Programming Language</BookTitle> 
    <Author>Stroustrup</Author> 
    <InStock>300</InStock> 
    <SellingPrice>62.50</SellingPrice> 
    <CostPrice>50.00</CostPrice> 
    <PublicationYear>2013</PublicationYear> 
    <Publisher>Addison-Wesley</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>33421111222</ISBN> 
    <BookTitle>Steve Jobs</BookTitle> 
    <Author>Walter Isaacson</Author> 
    <InStock>1000</InStock> 
    <SellingPrice>47.45</SellingPrice> 
    <CostPrice>40.25</CostPrice> 
    <PublicationYear>2011</PublicationYear> 
    <Publisher>Simpson and Schuster</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>43433333444</ISBN> 
    <BookTitle>Software Engineering</BookTitle> 
    <Author>Frank Tsui</Author> 
    <InStock>70</InStock> 
    <SellingPrice>53.53</SellingPrice> 
    <CostPrice>43.43</CostPrice> 
    <PublicationYear>2009</PublicationYear> 
    <Publisher>Wiley</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>58729955411</ISBN> 
    <BookTitle>Computer Security</BookTitle> 
    <Author>Frank Conklin</Author> 
    <InStock>30</InStock> 
    <SellingPrice>82.75</SellingPrice> 
    <CostPrice>80.00</CostPrice> 
    <PublicationYear>2010</PublicationYear> 
    <Publisher>Wiley</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>62588811432</ISBN> 
    <BookTitle>Things Fall Apart</BookTitle> 
    <Author>Chinua Achebe</Author> 
    <InStock>5</InStock> 
    <SellingPrice>12.00</SellingPrice> 
    <CostPrice>10.00</CostPrice> 
    <PublicationYear>1968</PublicationYear> 
    <Publisher>Longman</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>9780134527338</ISBN> 
    <BookTitle>Network Security Essentials</BookTitle> 
    <Author>William Stallings</Author> 
    <InStock>15</InStock> 
    <SellingPrice>95.24</SellingPrice> 
    <CostPrice>75.89</CostPrice> 
    <PublicationYear>2016</PublicationYear> 
    <Publisher>Pearson</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>77744555663</ISBN> 
    <BookTitle>No Easy Task</BookTitle> 
    <Author>Aubrey Kayira</Author> 
    <InStock>2</InStock> 
    <SellingPrice>7.00</SellingPrice> 
    <CostPrice>5.00</CostPrice> 
    <PublicationYear>1970</PublicationYear> 
    <Publisher>Penguin</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>97812345678</ISBN> 
    <BookTitle>Computer Networks</BookTitle> 
    <Author>Peterson</Author> 
    <InStock>8</InStock> 
    <SellingPrice>112.00</SellingPrice> 
    <CostPrice>100.00</CostPrice> 
    <PublicationYear>2004</PublicationYear> 
    <Publisher>Morgan Kaufman</Publisher> 
    </book><bookstore> 
    <book> 
    <ISBN>87062662662</ISBN> 
    <BookTitle>Differential Equations</BookTitle> 
    <Author>Perko</Author> 
    <InStock>12</InStock> 
    <SellingPrice>95.00</SellingPrice> 
    <CostPrice>90.00</CostPrice> 
    <PublicationYear>2000</PublicationYear> 
    <Publisher>Elsevier</Publisher> 
    </book> 
    <book> 
    <ISBN>70626626621</ISBN> 
    <BookTitle>Computers in Action 9th Ed</BookTitle> 
    <Author>Parsley</Author> 
    <InStock>500</InStock> 
    <SellingPrice>130.00</SellingPrice> 
    <CostPrice>90.00</CostPrice> 
    <PublicationYear>2013</PublicationYear> 
    <Publisher>Pearson</Publisher> 
    </book> 
</bookstore> 

そして、私のXSLドキュメントです:

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:template match="/"> 
<html> 
<body> 
    <h2>Bookstore Inventory</h2> 
    <table border="1"> 
    <tr bgcolor="#9acd32"> 
     <th style="text-align:left">BookTitle</th> 
     <th style="text-align:left">Author</th> 
     <th style="text-align:left">SellingPrice</th> 
     <th style="text-align:left">PublicationYear</th> 
     <th style="text-align:left">Publisher</th> 
    </tr> 
    <xsl:for-each select="bookstore/book"> 
    <tr> 
     <td><xsl:value-of select="booktitle"/></td> 
     <td><xsl:value-of select="author"/></td> 
     <td><xsl:value-of select="sellingprice"/></td> 
     <td><xsl:value-of select="publicationyear"/></td> 
     <td><xsl:value-of select="publisher"/></td> 
    </tr> 
    </xsl:for-each> 
    </table> 
</body> 
</html> 
</xsl:template> 
</xsl:stylesheet> 

が、私はこれがたくさんある知っている、と私は任意の助けに感謝

は、ここに私のXML文書です。

ありがとうございました!

+0

XSLTドキュメントはXMLドキュメントと同じですが、コピー&ペーストエラーだと思います。 – Meyer

+1

''要素が多すぎます。あなたは ''タグを開きましたが、 ''タグは閉じていません。したがって、あなたのXMLは整形式ではありません。 – zx485

+0

**解決方法:**すべての ''要素を最初のものから取り除き、最後に閉じたものを追加してください。 – zx485

答えて

1

XMLは大文字と小文字が区別される:

<xsl:value-of select="booktitle"/>

BookTitleという名前の要素の値を取得することはありません。それ以外は、XSLTはうまくいくようです。しかし、あなたの入力はありません。

+0

FYI(Brandon):他のすべての「選択」式も大文字小文字の不一致のために間違っていました。 – zx485