PKM2数据导出的xml显示用的XSL
2010-01-11 03:05
288 查看
PKM2这个个人知识管理软件相信很多人用过,可以把数据导出为chm电子书,但是不知道为什么倒出来的chm不能按照标题排序,所以我就导出为xml格式,弄个xsl来显示它.
XSL代码如上,xsl文件保存为: show.xsl,修改XMLDB.xml文件,
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="show.xsl"?>+++++插入左边的这一行.
<?xml version="1.0" encoding="gb2312"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="4.0" indent="yes"/> <xsl:template match="/"> <html> <head> <TITLE>hh</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> <meta name="Author" content="(webuc.net)" /> <meta name="Description" content="" /> <mce:style><!-- body{margin:0px;color:black;font-size:9pt;} div{background-color:#fff;border:1px solid #4682B4;} p{indent:2em;margin-left:15px;} ul{} li{margin-left:10px;} a:link {color: #2c4c78; text-decoration: none} a:visited {color: #2c4c78; text-decoration: none} a:hover {color: #8B0C01; text-decoration: underline} a:active {color: red; text-decoration: none} #left_nav{margin:10px;float:left;clear:left;width:250px;height:600px;overflow:scroll;} #right_content{margin:10px;float:left;clear:right;width:600px;height:600px;overflow:scroll;} --></mce:style><style mce_bogus="1">body{margin:0px;color:black;font-size:9pt;} div{background-color:#fff;border:1px solid #4682B4;} p{indent:2em;margin-left:15px;} ul{} li{margin-left:10px;} a:link {color: #2c4c78; text-decoration: none} a:visited {color: #2c4c78; text-decoration: none} a:hover {color: #8B0C01; text-decoration: underline} a:active {color: red; text-decoration: none} #left_nav{margin:10px;float:left;clear:left;width:250px;height:600px;overflow:scroll;} #right_content{margin:10px;float:left;clear:right;width:600px;height:600px;overflow:scroll;}</style> </head> <body> <div id="main"> <xsl:apply-templates select="XMLDB"/> </div> </body> </html> </xsl:template> <xsl:template match="XMLDB"> <div id="left_nav"><xsl:apply-templates select="NodeList"/></div> <div id="right_content"><xsl:apply-templates select="ItemList"/></div> </xsl:template> <xsl:template match="NodeList"> <h1><xsl:value-of select="Node/Category" /></h1> <ul> <xsl:for-each select="//XMLDB//ItemList//Item"> <xsl:sort select="Title" order="ascending"/> <li> <xsl:element name="a"> <xsl:attribute name="href">#<xsl:value-of select="IDKey" /></xsl:attribute> <xsl:value-of select="Title" /> </xsl:element> </li> </xsl:for-each> </ul> </xsl:template> <xsl:template match="ItemList"> <xsl:for-each select="Item"> <p> <xsl:element name="a"> <xsl:attribute name="name">#<xsl:value-of select="IDKey" /></xsl:attribute> </xsl:element> <xsl:value-of select="Content" disable-output-escaping="yes" /> </p> </xsl:for-each> </xsl:template> </xsl:stylesheet>
XSL代码如上,xsl文件保存为: show.xsl,修改XMLDB.xml文件,
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="show.xsl"?>+++++插入左边的这一行.
相关文章推荐
- 选择模式:xml通过同目录下的xsl显示数据
- 如何把 XML 数据显示为 HTML(加载XML/XSL几种方式)
- 异步加载封装结果为xml数据,xsl文件解析xml数据显示在指定的div中
- XML基础知识学习八(使用XSL来显示XML数据)
- 通过xsl显示和输出XML数据
- XML入门指南(9)使用XSL来显示XML数据
- 通过xsl显示和输出XML数据2
- 在C#中采用自定义标签和XML、XSL显示数据
- 利用XSL对XML中的数据进行数据显示之一
- 在asp.net(C#)中采用自定义标签和XML、XSL显示数据
- XML入门指南(9)使用XSL来显示XML数据
- XML+XSL在表格中显示数据的主要程序
- 用js如何实现读取xml数据并且显示在html中
- XML的显示--XSL
- 在 HTML 中显示 XML 数据
- 多行变成一列数据 用XML方式显示连接在一起
- javascript XML数据显示为HTML一例
- JQuery读取XML文件数据并显示
- Java大批量导出数据,格式可以为xml或excel