-- 作者:geezercn
-- 发布时间:6/30/2007 3:17:00 PM
-- 请教,转换为html后,自动多出的两个空行是怎么回事呢?
XML文件: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <div_main> <!--××××××××××××××××××××××页面标题 ××××××××××××××××××××××××××××××××--> <div_head> <text>标题</text> <image>image/head_image.png</image> <link>#</link> <descript>这个记录的是文档标题,必须显示在文件的最上方!</descript> </div_head> <!--××××××××××××××××××××××页面菜单×××××××××××××××××××××××××××××××××--> <div_menu> <menu> <ico>image/menu_ico1.png</ico> <text>档案管理</text> <descript></descript> <link>#</link> </menu> <menu> <ico>image/menu_ico1.png</ico> <text>采购管理</text> <descript></descript> <link>#</link> </menu> <menu> <ico>image/menu_ico1.png</ico> <text>销售管理</text> <descript></descript> <link>#</link> </menu> <menu> <ico>image/menu_ico1.png</ico> <text>库存管理</text> <descript></descript> <link>#</link> </menu> <menu> <ico>image/menu_ico1.png</ico> <text>报表管理</text> <descript></descript> <link>#</link> </menu> <menu> <ico>image/menu_ico1.png</ico> <text>系统管理</text> <descript></descript> <link>#</link> </menu> <menu> <ico>image/menu_ico1.png</ico> <text>退出系统</text> <descript></descript> <link>#</link> </menu> </div_menu> <!--××××××××××××××××××××××页面主显示区域××××××××××××××××××××××××××××××××× --> <div_area> <group> <head>基本档案</head> <tr> <item> <text>商品档案</text> <http>#</http> <descript></descript> </item> <item> <text>供应商档案</text> <http>#</http> <descript></descript> </item> <item> <text>客户档案</text> <http>#</http> <descript></descript> </item> <item> <text>人员信息</text> <http>#</http> <descript></descript> </item> </tr> <tr> <item> <text>包装信息</text> <http>#</http> <descript></descript> </item> <item> <text>其它信息</text> <http>#</http> <descript></descript> </item> </tr> </group> <group> <head>核心业务</head> <tr> <item> <text>商品议价</text> <http>#</http> <descript></descript> </item> <item> <text>供货合同</text> <http>#</http> <descript></descript> </item> <item> <text>购进计划</text> <http>#</http> <descript></descript> </item> <item> <text>采购订单</text> <http>#</http> <descript></descript> </item> </tr> <tr> <item> <text>收货入库</text> <http>#</http> <descript></descript> </item> <item> <text>其它信息</text> <http>#</http> <descript></descript> </item> </tr> </group> </div_area> <!--××××××××××××××××××××××页面页脚×××××××××××××××××××××××××××××××××××××××--> <div_foot> <company>广东WEB设计联盟</company> <address>广东省深圳市XXX大道123号</address> <post>518000</post> <telphone>0755-26011111 0755-26011000</telphone> <fax>0755-26011111 0755-26011000</fax> <http>http://www.chinaweb_design.com.cn</http> </div_foot> </div_main> xsl文件: <?xml version="1.0" encoding="utf-8"?> <!-- DWXMLSource="div_area_list.xml" --> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> <!ENTITY copy "©"> <!ENTITY reg "®"> <!ENTITY trade "™"> <!ENTITY mdash "—"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY pound "£"> <!ENTITY yen "¥"> <!ENTITY euro "€"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </meta> <title>主页面分区导航</title> <link href="main_page.css" rel="stylesheet" type="text/css"> </link> <style type="text/css"> <xsl:comment> body { margin-bottom: 10px; } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: underline; } a:active { text-decoration: none; } </xsl:comment> </style> </head> <body> <div id="div_main"> <!--××××××××××××××××××××××页面标题区域××××××××××××××××××××××××××××××××× --> <div id="div_head"> <xsl:for-each select="div_main"> <!--显示标题文字--> <h1> <xsl:value-of select="div_head/text" /> </h1> <!--显示标题图片--> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="div_head/link"/> </xsl:attribute> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="div_head/image"/> </xsl:attribute> </xsl:element> </xsl:element> </xsl:for-each> </div> <!--××××××××××××××××××××××页面导航菜单××××××××××××××××××××××××××××××××× --> <div id="div_menu"> <ul> <xsl:for-each select="div_main/div_menu/menu"> <li> <!--显示导航菜单项--> <!--显示导航菜单项的图片--> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="ico" /> </xsl:attribute> </xsl:element> <xsl:element name="a"> <!--显示导航菜单项的链接地址--> <xsl:attribute name="href"> <xsl:value-of select="link"/> </xsl:attribute> <!--显示导航菜单项的文字--> <xsl:value-of select="text" /> </xsl:element> </li> </xsl:for-each> </ul> </div> <!--××××××××××××××××××××××页面主显示区域××××××××××××××××××××××××××××××××× --> <div id="div_area"> <!-- 读取多组项目 --> <xsl:for-each select="div_main/div_area/group" > <div id="div_area_group"> <!-- 显示分组标题--> <xsl:value-of select="head" /> <table border="0" cellspacing="0" cellpadding="0"> <!-- 多行项目读取 --> <xsl:for-each select="tr"> <tr> <!--行内项目重复读取--> <xsl:for-each select="item" > <td><xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="http" /> </xsl:attribute> <xsl:value-of select="text" /> </xsl:element> </td> </xsl:for-each> </tr> </xsl:for-each> </table> </div> </xsl:for-each> </div> <!--××××××××××××××××××××××页面页脚属性××××××××××××××××××××××××××××××××× --> <div id="div_foot"> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="div_main/div_foot/http" /> </xsl:attribute> <xsl:value-of select="div_main/div_foot/company" /> </xsl:element> <p> 地址:<xsl:value-of select="div_main/div_foot/address" /> <xsl:value-of select="div_main/div_foot/post" /> </p> <p> 电话:<xsl:value-of select="div_main/div_foot/telphone" /> </p> <P> 传真: <xsl:value-of select="div_main/div_foot/fax" /> </P> <P> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="div_main/div_foot/http" /> </xsl:attribute> <xsl:value-of select="div_main/div_foot/http" /> </xsl:element> </P> </div> </div> </body> </html> </xsl:template> </xsl:stylesheet> CSS文件: @charset "utf-8"; body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } #div_main { font-size: 80%; margin: 5px; width: 1020; } #div_main #div_head { float: left; width: 100%; margin: 0px; } #div_main #div_head h1 { float: right; padding-left: 20px; } #div_main #div_menu { float: left; margin: 0px; width: 100%; background-color: #CCFF33; height: 28px; } #div_main #div_menu img { padding-right: 6px; padding-left: 6px; } #div_main #div_menu li { float: left; padding-left: 12px; padding-top: 4px; padding-right: 6px; } #div_main #div_menu a { text-decoration: none; } #div_main #div_head img { float: left; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; } #div_main #div_area { width: 100%; height: 450px; border: 1px solid #999999; } #div_main #div_area #div_area_group { margin: 10px; padding-bottom: 20px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-bottom-style: solid; border-top-color: #CCCC33; border-right-color: #CCCC33; border-bottom-color: #CCCC33; border-left-color: #CCCC33; } #div_main #div_area #div_area_group h5 { padding-top: 8px; padding-left: 20px; padding-bottom: 0px; clear: both; } #div_main #div_area #div_area_group td { padding-left: 16px; width: 220px; background-image: url(image/list_item.gif); background-repeat: no-repeat; background-position: left center; padding-top: 0px; } #div_main #div_area #div_area_group table { } #div_main #div_foot { border-top-width: 3px; border-right-width: 3px; border-bottom-width: 3px; border-left-width: 3px; border-top-style: solid; border-top-color: #00FF00; border-right-color: #00FF00; border-bottom-color: #00FF00; border-left-color: #00FF00; } #div_main #div_foot p { height: 6px; margin: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 24px; } #div_main #div_area p { padding: 10px; } 附件中是显示的效果,多出了两个空行, 谁能帮我一下,看看是怎么回事!
此主题相关图片如下:
|