xml是元标记语言,与html不同,它只承载数据,类似数据库.
若要它呈现出样式,可与html配合或用xslt和css

解决方案 »

  1.   

    如何将xml数据显示在网页上呢
      

  2.   

    写一个配套的.css文件。例如:
    books.xml文件如下:
    <?xml version="1.0"?>
    <?xml-stylesheet href="Books.css" type="text/css"?>
    <books>
      <book>
        <title>Beginning ASP.NET</title>
        <ISBM>1-861006-15-2</ISBM>
        <authors>
    <author>Chiris Ullman</author>
    <author>Ollie Cornes</author>
    <author>John Kauffman</author>
           <author>Rob Birdwell</author>
        </authors>
        <description>ASP.NET is a powerful technology for.....</description>
        <price US="$49.99"/>
      </book>
    </books>再写一个books.css,用于控制xml的显示:title 
    {
    display:block;
    font-family:Courier New;
    font-size:large;
    font-weight:bold;
    color:Red;
    text-align:center;
    }
    ISBN
    {
    display: block;
    font-family: 宋体;
    font-size: medium;
    font-weight: bold;
    color: Black;
    text-align: left;
    }
    authors
    {
    display: block;
    font-family: 宋体;
    font-size: small;
    font-weight: normal;
    color: Black;
    text-align: left;
    }
    description
    {
    display: block;
    font-family: 宋体;
    font-size: small;
    font-weight: normal;
    color: Black;
    text-align: left;
    }然后就可以了。