PKM2這個個人知識管理軟體相信很多人用過,可以把資料匯出為chm電子書,但是不知道為什麼倒出來的chm不能按照標題排序,所以我就匯出為xml格式,弄個xsl來顯示它.
<?xml version="1.0" encoding="gb2312"?><br /><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><br /><xsl:output method="html" version="4.0" indent="yes"/></p><p><xsl:template match="/"><br /><html><br /><head><br /><TITLE>hh</TITLE><br /><meta http-equiv="Content-Type" content="text/html; charset=gb2312"/><br /><meta name="Author" content="(webuc.net)" /><br /><meta name="Description" content="" /><br /><mce:style><!--<br />body{margin:0px;color:black;font-size:9pt;}<br />div{background-color:#fff;border:1px solid #4682B4;}<br />p{indent:2em;margin-left:15px;}<br />ul{}</p><p>li{margin-left:10px;}<br />a:link {color: #2c4c78; text-decoration: none}<br />a:visited {color: #2c4c78; text-decoration: none}<br />a:hover {color: #8B0C01; text-decoration: underline}<br />a:active {color: red; text-decoration: none}<br />#left_nav{margin:10px;float:left;clear:left;width:250px;height:600px;overflow:scroll;}<br />#right_content{margin:10px;float:left;clear:right;width:600px;height:600px;overflow:scroll;}<br />--></mce:style><style mce_bogus="1">body{margin:0px;color:black;font-size:9pt;}<br />div{background-color:#fff;border:1px solid #4682B4;}<br />p{indent:2em;margin-left:15px;}<br />ul{}</p><p>li{margin-left:10px;}<br />a:link {color: #2c4c78; text-decoration: none}<br />a:visited {color: #2c4c78; text-decoration: none}<br />a:hover {color: #8B0C01; text-decoration: underline}<br />a:active {color: red; text-decoration: none}<br />#left_nav{margin:10px;float:left;clear:left;width:250px;height:600px;overflow:scroll;}<br />#right_content{margin:10px;float:left;clear:right;width:600px;height:600px;overflow:scroll;}</style><br /></head></p><p><body><br /><div id="main"></p><p> <xsl:apply-templates select="XMLDB"/></p><p></div><br /></body><br /></html><br /></xsl:template></p><p><xsl:template match="XMLDB"><br /><div id="left_nav"><xsl:apply-templates select="NodeList"/></div><br /><div id="right_content"><xsl:apply-templates select="ItemList"/></div><br /></xsl:template></p><p><xsl:template match="NodeList"></p><p> <h1><xsl:value-of select="Node/Category" /></h1></p><p><ul><br /><xsl:for-each select="//XMLDB//ItemList//Item"> </p><p> <xsl:sort select="Title" order="ascending"/><br /> <li><br /> <xsl:element name="a"><br /> <xsl:attribute name="href">#<xsl:value-of select="IDKey" /></xsl:attribute><br /> <xsl:value-of select="Title" /><br /> </xsl:element><br /> </li></p><p></xsl:for-each> </p><p></ul><br /></xsl:template></p><p><xsl:template match="ItemList"></p><p> <xsl:for-each select="Item"> </p><p> <p><br /> <xsl:element name="a"><br /> <xsl:attribute name="name">#<xsl:value-of select="IDKey" /></xsl:attribute><br /> </xsl:element> </p><p> <xsl:value-of select="Content" disable-output-escaping="yes" /><br /> </p></p><p> </xsl:for-each> </p><p></xsl:template></p><p></xsl:stylesheet>
XSL代碼如上,xsl檔案儲存為: show.xsl,修改XMLDB.xml檔案,
<?xml version="1.0" encoding="gb2312"?>
<?xml-stylesheet type="text/xsl" href="show.xsl"?>+++++插入左邊的這一行.