Html cvc elt.1教程5“新视角”

Html cvc elt.1教程5“新视角”,html,css,xml,xslt,Html,Css,Xml,Xslt,在我的XML在线课程中,我被分配完成本教程 Jenna一直在努力创建一个DVD库,在那里她可以列出她拥有的所有DVD。有些是她自己买的,有些是她妈妈、爸爸、姐姐、爷爷和奶奶送给她的礼物。她的库的根元素是带有一个或多个dvd元素的dvd库。每张dvd都有标题、说明、年份、公司、喜爱的角色、喜爱的奖励功能和购买信息。她的每个角色元素都有一个或多个角色元素。她的奖励元素都有一个或多个特征。她购买的每个元素都有价格、位置和日期。dvd元素有两个属性,奖金元素有一个属性,购买的元素没有属性。 Jenna希

在我的XML在线课程中,我被分配完成本教程

Jenna一直在努力创建一个DVD库,在那里她可以列出她拥有的所有DVD。有些是她自己买的,有些是她妈妈、爸爸、姐姐、爷爷和奶奶送给她的礼物。她的库的根元素是带有一个或多个dvd元素的dvd库。每张dvd都有标题、说明、年份、公司、喜爱的角色、喜爱的奖励功能和购买信息。她的每个角色元素都有一个或多个角色元素。她的奖励元素都有一个或多个特征。她购买的每个元素都有价格、位置和日期。dvd元素有两个属性,奖金元素有一个属性,购买的元素没有属性。 Jenna希望创建一个XSLT样式表,用于漂亮地显示DVD收藏信息。她已经为页面创建了CSS样式表

完成以下内容:

<section>
<h1>DVD List</h1>
dvd template
</section>
<p>
      Bonus Features:
<span>
feature/feature/ …
</span>
</p>
使用文本编辑器打开文件dvdlibrary.txt。查看内容以熟悉XML文件的结构。 在序言中添加一条注释,说明文件、姓名、日期和文件名。 将文件另存为dvdlibrary.xml。 在将dvdlibrary.xsl样式表附加到此XML文档的注释部分后添加处理说明。关闭文件,保存更改。 使用文本编辑器打开文件dvdlibrarytxt.xsl。在文件的注释部分输入您的姓名和日期,并将其另存为dvdlibrary.xsl。 转到文本编辑器中的dvdlibrary.xsl文件,然后转到根模板。将以下命令添加到模板中:

<html>
<head>
<title>Jenna's DVD Collection</title>
<link href="dvdlibrarystyles.css"
rel="stylesheet" type="text/css" />
</head>
<body>
<header>
<h1>Jenna's DVD Collection</h1>
</header>
</body>
</html>
<article>
</article>
但我一直收到一个错误,上面写着: cvc elt.1:找不到元素“dvdlibrary”的声明。

在测试XSLT的最佳位置测试XSLT时,给出的错误消息与您给出的错误消息并不匹配

Error 1 at line 25:51 : Invalid element <article> within xsl:apply-templates
你需要这样做,也要纠正拼写错误

<xsl:for-each select="characters/character">
    <h2>
        <xsl:value-of select="."/>
    </h2>
</xsl:for-each>
无论如何,先试试这个XSLT,您可以在


你应该把你的问题简化一点。如果您正在尝试完成一个教程,可以寻求帮助,但我们并不需要查看整个教程。理想情况下,我们只需要一个。i、 显示XML、您尝试过的XSLT、您期望的输出以及您得到的输出或错误。CSS在这种情况下并不真正相关。谢谢
<?xml version="1.0" encoding="UTF-8"?>

<!--
This document contains data about Jenna's DVD library. 

Author: Julia Turek
Date: 6/25/2018

Filename: dvdlibrary.xml
Supporting File: dvdlibrary.xsl
-->

<?xml-stylesheet type="text/xsl" href="dvdlibrary.xsl" ?>

<dvdlibrary>  
    <dvd isbn="1-4157-4399-0" from="mom" >
        <title>Kung Fu Lizard</title>
        <description>Jo defends his training academy against the evil Mighty Moose, Benny.</description>
        <year>2011</year>
        <company>Cloud Nine Productions</company>
        <characters>
            <character>Jo, the Kung Fu Lizard</character>
            <character>Lisa, the Fighting Kricket</character>
            <character>Benny, the Evil Mangler Moose</character>
        </characters>
        <bonus num="2">
            <feature>Kung Fu Academy</feature>
            <feature>Cast Commentary</feature>
        </bonus>
        <purchased>
            <price>19.94</price>
            <location>Best DVDs in Town</location>
            <date>2012-10-03</date>
        </purchased>
    </dvd>

    <dvd isbn="1-5158-4399-0" from="mom">
        <title>Planet of the Ogres</title>
        <description>Bilbo had always dreamt he was from another planet. Now he finds out that he is. Join him as he meets his destiny to save his homeworld.</description>
        <year>2012</year>
        <company>MGM</company>
        <characters>
            <character>Bilbo, future leader of the Ogres</character>
            <character>Kilnary, leader of the invading Tigres</character>
            <character>Wicket, leader of the Morkian army</character>
        </characters>
        <bonus num="3">
            <feature>Making Of Featurette</feature>
            <feature>Theatre Trailers</feature>
            <feature>PC downloadable version</feature>
        </bonus>
        <purchased>
            <price>17.99</price>
            <location>Mallmart</location>
            <date>2013-10-06</date>
        </purchased>
    </dvd>

    <dvd isbn="1-9955-8745-0" from="mom">
        <title>Mountain King</title>
        <description>Freda is the daughter of the Mountain King. As the only heir, will she break with tradition and be the first Mountain Queen?</description>
        <year>2014</year>
        <company>Sunny Entertainment</company>
        <characters>
            <character>Freda, daughter of the Mountain King</character>
            <character>Toru, the Mountain King</character>
            <character>Ella, the Enchanted Advisor</character>
           <character>Bopo, the Monkey Bone Wizard</character>
        </characters>
        <bonus num="2">
            <feature>Cast Commentary</feature>
            <feature>Mountain King Music Video</feature>
        </bonus>
        <purchased>
            <price>14.99</price>
            <location>Movies For Everyone</location>
            <date>2015-11-07</date>
        </purchased>
    </dvd>
</dvdlibrary>
<?xml version="1.0" encoding="UTF-8" ?>

<!--
   Project 5
   Tutorial Project

   DVD Library XSLT Style Sheet
   Author: Julia Turek
   Date:   6/28/18

   Filename: dvdlibrary.xsl
-->

<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:output method="html"
      doctype-system="about:legacy-compat"
      encoding="UTF-8"
      indent="yes" />

   <xsl:template match="/">
    <html>
        <head>
            <title>Jenna's DVD Collection</title>
            <link href="dvdlibrarystyles.css" rel="stylesheet" type="text/css" />
        </head>
        <body>
            <header>
                <h1>Jenna's DVD Collection</h1>
            </header>
            <section>
                <h1>DVD List</h1>
                <xsl:apply-templates select="dvdlibrary/dvd">
                <xsl:sort select="title" />
                </xsl:apply-templates>

                <xsl:apply-templates select="dvd">
                    <article>    
                        <xsl:for-each select="dvd/title">
                        <h1>
                            <xsl:value-of select="title"/>
                        </h1>
                        </xsl:for-each>                    
                        <xsl:for-each select="chracters/character">
                            <h2>
                                <xsl:value-of select="character"/>
                            </h2>
                        </xsl:for-each>
                        <p>
                            Bonus Features:
                            <span>
                                <xsl:for-each select="bonus/featuress"/>
                            </span>
                        </p>


                        <table>
                            <tr>
                                <th>Price</th>
                                <th>Location</th>
                                <th>Date</th>
                            </tr>
                            <tr>
                                <td>price</td>
                                <td>location</td>
                                <td>date</td>
                            </tr>
                        </table>


                    </article>
                </xsl:apply-templates>

            </section>
        </body>
    </html>

   </xsl:template>

</xsl:stylesheet>
    * {
   margin: 0px;
   list-style: none;
}

header, section, article {
   display: block;
}



/* Body styles */
body {
   background-color: white;
   font-family: Verdana, Geneva, sans-serif;
   margin: 10px auto;
   width: 920px;
}

header h1 {
   color: white;
   font-size: 2.8em;
   font-weight: normal;
   text-shadow: rgb(90, 127, 0) 0px 0px 25px;
}

header h2 {
   font-size: 1.5em;
   font-weight: normal;
   color: rgb(90, 127, 0);
}

section {
   margin-top: 25px;
}

section > h1 {
   font-weight: normal;
   font-size: 1.9em;
}

article {
   border: 1px solid black;
   margin: 10px 10px;
   padding: 10px;
   width: 400px;
   float: left;
   box-shadow: rgb(151, 151, 151) 8px 8px 15px;
}

article > h1, article > h2 {
   background-color: rgb(190, 235, 110);
}

article > h1 {
   font-size: 1em;
   font-weight: normal;
   padding: 10px 0px 0px 10px;
}

article > h2 {
   font-size: 0.7em;
   font-weight: normal;
   padding: 0px 0px 10px 10px;
   border-bottom: 1px solid black;
}

article > p {
   font-size: 0.7em;
   margin: 4px 0px 0px 0px;
}

article span {
   color: rgb(151,151, 151);
}

table {
   border-collapse: collapse;
   margin: 10px 0px 5px 0px;
}

td, th {
   border: 1px solid rgb(191, 191, 191);
   font-weight: normal;
   font-size: 0.7em;
   padding: 3px;
   text-align: center;
}

th {
   background-color: rgb(231, 231, 231);
}
Error 1 at line 25:51 : Invalid element <article> within xsl:apply-templates
<xsl:apply-templates select="dvd">
    <article>    
<xsl:for-each select="chracters/character">
    <h2>
        <xsl:value-of select="character"/>
    </h2>
</xsl:for-each>
<xsl:for-each select="characters/character">
    <h2>
        <xsl:value-of select="."/>
    </h2>
</xsl:for-each>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:output method="html"
      doctype-system="about:legacy-compat"
      encoding="UTF-8"
      indent="yes" />

   <xsl:template match="/">
    <html>
        <head>
            <title>Jenna's DVD Collection</title>
            <link href="dvdlibrarystyles.css" rel="stylesheet" type="text/css" />
        </head>
        <body>
            <header>
                <h1>Jenna's DVD Collection</h1>
            </header>
            <section>
                <h1>DVD List</h1>
                <xsl:apply-templates select="dvdlibrary/dvd">
                <xsl:sort select="title" />
                </xsl:apply-templates>
            </section>
        </body>
    </html>
   </xsl:template>

    <xsl:template match="dvd">
        <article>    
            <h1>
                <xsl:value-of select="title"/>
            </h1>
            <xsl:for-each select="characters/character">
                <h2>
                    <xsl:value-of select="."/>
                </h2>
            </xsl:for-each>
            <p>
                Bonus Features:
                <xsl:for-each select="bonus/feature">
                    <span>
                        <xsl:value-of select="." />
                    </span>
                </xsl:for-each>
            </p>
        </article>
    </xsl:template>   
</xsl:stylesheet>