如何在html文件中输出xml内容?

如何在html文件中输出xml内容?,html,xml,xslt,Html,Xml,Xslt,我已经用一个xsl文件创建了一个xml文件,设计很好,可以正常工作。但是,我不知道如何查看在html文件中打开xml文件时看到的相同内容。我想保留html页面上的一些内容,但也包括xml文件的内容。 以下是xml文件的代码: <?xml version="1.0" ?> <?xml-stylesheet type="text/xsl" href="menudesign.xsl"?> <Food>

我已经用一个xsl文件创建了一个xml文件,设计很好,可以正常工作。但是,我不知道如何查看在html文件中打开xml文件时看到的相同内容。我想保留html页面上的一些内容,但也包括xml文件的内容。 以下是xml文件的代码:

<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="menudesign.xsl"?>
<Food>
    <Breakfast>
        <Pancakes>
            <Description>The Best Fluffy Pancakes you will ever fall in love with. One Serving includes 3 pancakes with a square
                         of butter on top and a side of warm maple syrup.</Description>
            <Price>15 AED</Price>
            <Ingredients>Eggs, Flour, Butter, Sugar, Baking Powder</Ingredients>
            <Calories>400</Calories>
        </Pancakes>
    </Breakfast>
    <Breakfast>
        <Eggs>
            <ScrambledEggs>
                <Description Price="10 AED">A customer's review: "These ACTUALLY changed my life. They are amazing!! So creamy. So tasty."
                             Served with 2 slices of toasted white bread and tea</Description>
                <Ingredients>Eggs, Cream, Butter, Thyme</Ingredients>
                <Calories>185</Calories>
            </ScrambledEggs>
        </Eggs>
    </Breakfast>
    <Breakfast>
        <Eggs>
            <SunnySideUp>
                <Description>Who doesn't love the classic Sunny Side Up Eggs? Served with 2 slices of toasted white bread and tea. </Description>
                <Price>8.50 AED</Price>
                <Ingredients>Eggs, Olive Oil</Ingredients>
                <Calories>130</Calories>
            </SunnySideUp>
        </Eggs>
    </Breakfast>
    <MainCourse>
        <Burrito>
            <Description>Seriously satisfying, our Burrito is a soft, warm tortilla wrapped to contain our juicy 
                        chicken with rice and beans topped with sour cream, salsa and Mozarella Cheese. </Description>
            <Price>20 AED</Price>
            <Ingredients>Flour Tortilla, Salsa, Chicken, Tomatoes, Onions, Mozarella Cheese, Beans and Sour Cream</Ingredients>
            <Calories>480</Calories>
        </Burrito>
    </MainCourse>
    <MainCourse>
        <Burger>
            <Description>It's juicy and greasily satisfying. The bun is toasted on the inside and soft outside. 
                         The cheese happily melting over the Chicken. Topped with coleslaw, our special sauce 
                         and pickles. Served with Fries and a Drink of your choice.</Description>
            <Price>30 AED</Price>
            <Ingredients>Bun, Cheddar Cheese, Chicken, Coleslaw, pickles, special sauce</Ingredients>
            <Calories>550</Calories>
        </Burger>
    </MainCourse>
    <MainCourse>
        <Shawarma>
            <MuttonShawarma>
                <Description>Our Mutton shawarma is marinated all day in seasonings and spices like garlic, turmeric, 
                             dried lime, cinnamon, and cardamom, giving it a complex flavor both tangy and warm.</Description>
                <Price>6 AED</Price>
                <Ingredients>Mutton, Fries, Garlic Sauce, Pickles, Parsley</Ingredients>
                <Calories>200</Calories>
            </MuttonShawarma>
        </Shawarma>
    </MainCourse>
    <MainCourse>
        <Shawarma>
            <ChickenShawarma>
                <Description>Our Chicken shawarma has a very unique flavour and cooked to perfection.
                             Marinated in a simple blend of Orange Juice, Garlic, Dried Coriander and 
                             White Pepper. Our Juicy Chicken shawarma will leave you wanting more every time!</Description>
                <Price>5 AED</Price>
                <Ingredients>Chicken, Fries, Hot Sauce, Garlic Sauce, Pickles, Parsley</Ingredients>
                <Calories>220</Calories>
            </ChickenShawarma>
        </Shawarma>
    </MainCourse>
    <Beverages>
        <Juices>
            <Mango>
                <Description>Fresh Mango Juice. With protein, carbohydrates, vitamins A, C, B, E and K present in one glass,
                            we ask ourselves how can something so delicious be so healthy?</Description>
                <Price>10 AED</Price>
                <Ingredients>Mangos</Ingredients>
                <Calories>140</Calories>
            </Mango>
        </Juices>
    </Beverages>
    <Beverages>
        <Juices>
            <Apple>
                <Description>Fresh Apple Juice. Made with a blend of 2 different apples. There's nothing quite like our
                             chilled Apple Juice on a Hot day.</Description>
                <Price>10 AED</Price>
                <Ingredients>Granny Smith Apples, Fuji Apples and Ice</Ingredients>
                <Calories>120</Calories>
            </Apple>
        </Juices>
    </Beverages>
    <Beverages>
        <Fizzy>
            <Sprite>
                <Description>Classic Sprite.</Description>
                <Price>2.5 AED</Price>
                <Ingredients>The main ingredients in Sprite are water, high-fructose corn syrup, and natural lemon and lime flavors. 
                            It also contains citric acid, sodium citrate, and sodium benzoate.</Ingredients>
                <Calories>146</Calories>
            </Sprite>
        </Fizzy>
    </Beverages>
    <Beverages>
        <Fizzy>
            <Coke>
                <Description>Classic Coca Cola</Description>
                <Price>2.5 AED</Price>
                <Ingredients>Carbonated Water, High Fructose Corn Syrup, Caramel Colour, Phosphoric Acid, Natural Flavours and Caffeine</Ingredients>
                <Calories>140</Calories>
            </Coke>
        </Fizzy>
    </Beverages>    
</Food>

你会爱上的最好的松软煎饼。一份包括3个方形煎饼
在上面涂一层黄油和一面温枫糖浆。
15 AED
鸡蛋、面粉、黄油、糖、发酵粉
400
一位顾客的评论:“这些实际上改变了我的生活。它们太棒了!!太奶油了。太好吃了。”
配2片烤白面包和茶
鸡蛋、奶油、黄油、百里香
185
谁不喜欢经典的单面煎鸡蛋?配2片烤白面包和茶。
8.50伊迪拉姆
鸡蛋、橄榄油
130
非常令人满意的是,我们的玉米煎饼是一种柔软、温暖的玉米饼,包裹着我们多汁的食物
鸡肉配米饭、豆子、酸奶油、萨尔萨和莫扎雷拉奶酪。
20 AED
面粉玉米饼、萨尔萨、鸡肉、西红柿、洋葱、莫扎雷拉奶酪、豆类和酸奶油
480
它多汁,油腻,令人满意。面包是在里面烤的,外面很软。
奶酪在鸡肉上愉快地融化了。加上凉拌卷心菜,这是我们的特色酱汁
还有泡菜。配炸薯条和你喜欢的饮料。
30 AED
面包,切达奶酪,鸡肉,凉拌卷心菜,泡菜,特制酱汁
550
我们的羊肉沙瓦玛全天候浸泡在调味品和香料中,如大蒜、姜黄、,
干莱姆、肉桂和豆蔻,给它带来了一种复杂的味道,既浓郁又温暖。
6 AED
羊肉、薯条、大蒜酱、泡菜、欧芹
200
我们的沙瓦玛鸡肉味道独特,烹调完美。
用橙汁、大蒜、干芫荽和柠檬混合腌制
白胡椒。我们的多汁鸡肉沙瓦玛会让你每次都想要更多!
5 AED
鸡肉、薯条、辣酱、大蒜酱、泡菜、欧芹
220
新鲜芒果汁。一杯中含有蛋白质、碳水化合物、维生素A、C、B、E和K,
我们扪心自问,这么美味的东西怎么会这么健康呢?
10 AED
芒果
140

  • 建议在加载XML时让浏览器应用XSLT。在这种情况下,如果在浏览器中呈现时只想在其他HTML文档中包含XML转换,请使用引用XML文档的
    iframe
    object
    元素。
    <?xml version="1.0" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/Food">
    <html>
    <body>
    <table align="center" width="700" border="2">
            <tr bgcolor="#00F1F1">
                <th>Breakfast</th>
            </tr>
            <xsl:for-each select="Breakfast/Pancakes">
            <tr>
                <td>Pancakes: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="Breakfast/Eggs/ScrambledEggs">
            <tr>
                <td>Scrambled Eggs: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="Breakfast/Eggs/SunnySideUp">
            <tr>
                <td>Sunny Side Up: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
    </table>
    <table align="center" width="700" border="2">
            <tr bgcolor="#00F1F1">
                <th>Main Course</th>
            </tr>
            <xsl:for-each select="MainCourse/Burrito">
            <tr>
                <td>Burrito: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="MainCourse/Burger">
            <tr>
                <td>Burger: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="MainCourse/Shawarma/MuttonShawarma">
            <tr>
                <td>Mutton Shawarma: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="MainCourse/Shawarma/ChickenShawarma">
            <tr>
                <td>Chicken Shawarma: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
    <table align="center" width="700" border="2">
            <tr bgcolor="#00F1F1">
                <th>Beverages</th>
            </tr>
            <xsl:for-each select="Beverages/Juices/Mango">
            <tr>
                <td>Mango Juice: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="Beverages/Juices/Apple">
            <tr>
                <td>Apple Juice: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="Beverages/Fizzy/Sprite">
            <tr>
                <td>Sprite: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
            <xsl:for-each select="Beverages/Fizzy/Coke">
            <tr>
                <td>Coca-Cola: <xsl:value-of select="Description"/>
                <br/>Price: <xsl:value-of select="Price"/>
                <br/>Ingredients: <xsl:value-of select="Ingredients"/>
                <br/>Calories: <xsl:value-of select="Calories"/></td>
            </tr>
            </xsl:for-each>
    </table>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    
    <html>
        <head>
        <style>
        ul {
        position: fixed;
        top: 0;
        width: 100%;
        }
        ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background-color: #FDA50F;
        }
        li {
        float: left;
        }
        li a {
        display: block;
        color: white;
        text-align: center;
        padding: 16px 75px;
        text-decoration: none;
        }
        li a:hover:not(.active) {
        background-color: #00868B;
        }
    
        .active {
        background-color: #4CAF50;
        }
        </style>
            <title> Menu </title>
        </head>
        <body>
        <ul>
        <li><a href="default.asp">Home</a></li>
        <li><a href=main_page.html>Main Page</a></li>
        <li><a href="Deals.asp">Deals</a></li>
        <li><a href="contact.asp">Contact</a></li>
        <li><a href="about.asp">About</a></li>
        </ul>
        </body>
    </html>