PKM2資料匯出的xml顯示用的XSL

來源:互聯網
上載者:User

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"?>+++++插入左邊的這一行.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.