.net中使用xsl文件作為導(dǎo)航菜單的小例子
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="testweb.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Xml TransformSource="XSLTFile1.xslt" ID="minanva" runat="server"></asp:Xml>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace testweb
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
minanva.DocumentContent = @"<站點(diǎn)導(dǎo)航列表 來(lái)訪(fǎng)員工=''>
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='設(shè)計(jì)計(jì)劃' 站點(diǎn)編號(hào)='EPM' 站點(diǎn)鏈接='../NWEPDI.EPM.WEB/../Project/ProjectList.aspx?QueueType=EPM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='設(shè)計(jì)作業(yè)' 站點(diǎn)編號(hào)='DDM' 站點(diǎn)鏈接='../MoEngineer/ProjectMgr.aspx' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='設(shè)計(jì)流程' 站點(diǎn)編號(hào)='DFM' 站點(diǎn)鏈接='../MoFlow/CWorkItemList.aspx?QueueType=DFM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='印務(wù)管理' 站點(diǎn)編號(hào)='PPM' 站點(diǎn)鏈接='../MoPrint/PrintMgr.aspx?QueueType=PPM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='工時(shí)管理' 站點(diǎn)編號(hào)='WHM' 站點(diǎn)鏈接='../MoWorkHour/HourMgrPrj.aspx?QueueType=WHM0103' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='電子歸檔' 站點(diǎn)編號(hào)='ARC' 站點(diǎn)鏈接='../MoArchieve/ProjectMgr.aspx?QueueType=ARC0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='統(tǒng)計(jì)報(bào)表' 站點(diǎn)編號(hào)='SSM' 站點(diǎn)鏈接='../MoReports/ReportView.aspx?QueueType=SSM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='資料管理' 站點(diǎn)編號(hào)='DAM' 站點(diǎn)鏈接='../MoDocument/ProjectFileMgr.aspx?QueueType=DAM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱(chēng)='系統(tǒng)管理' 站點(diǎn)編號(hào)='DSM' 站點(diǎn)鏈接='../MoAdmin/CommonRuleList.aspx?QueueType=DSM0101' />
</站點(diǎn)導(dǎo)航列表>";
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="http://站點(diǎn)導(dǎo)航列表">
<div>
<ul>
<li>導(dǎo)航</li>
<xsl:for-each select="站點(diǎn)導(dǎo)航">
<li>
<xsl:value-of select="@站點(diǎn)名稱(chēng)"/>
<xsl:attribute name="id">
<xsl:value-of select="@站點(diǎn)編號(hào)"/>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="@站點(diǎn)鏈接"/>
</xsl:attribute>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:template>
</xsl:stylesheet>
相關(guān)文章
linq 查詢(xún) Linq 高級(jí)查詢(xún)實(shí)例代碼
本文針對(duì)Linq 高級(jí)查詢(xún)實(shí)例進(jìn)行詳解,需要了解的朋友可以參考下2013-01-01.NET Windbg分析某婦產(chǎn)醫(yī)院WPF內(nèi)存溢出
這篇文章主要為大家介紹了.NET Windbg分析某婦產(chǎn)醫(yī)院WPF內(nèi)存溢出,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2022-06-06GridView分頁(yè)代碼簡(jiǎn)單萬(wàn)能實(shí)用
GridView在使用.net技術(shù)搭建的后臺(tái),在商品列表或者是信息列表經(jīng)常會(huì)出現(xiàn);它的作用在于有效的管理信息,增刪改查等等最主要的是還可以實(shí)現(xiàn)分頁(yè),這一點(diǎn)是無(wú)可比靡的,接下來(lái)介紹如何使用GridView實(shí)現(xiàn)分頁(yè),需要了解的朋友可以參考下2012-12-12.Net中關(guān)于stirng轉(zhuǎn)System.Type的一種實(shí)現(xiàn)思路詳解
這篇文章主要給大家介紹了.Net中關(guān)于stirng轉(zhuǎn)System.Type的一種實(shí)現(xiàn)思路的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2018-05-05Linux上使用Docker部署ASP.NET?Core應(yīng)用程序
這篇文章介紹了使用Docker部署ASP.NET?Core應(yīng)用程序的方法,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2022-03-03Server.Transfer,Response.Redirect的區(qū)別
Server.Transfer,Response.Redirect的區(qū)別...2006-12-12利用sender的Parent獲取GridView中的當(dāng)前行(獲取gridview的值)
這篇文章主要介紹了利用sender的Parent獲取GridView中的當(dāng)前行的方法,大家參考使用吧2014-01-01ASP.NET頁(yè)面請(qǐng)求超時(shí)時(shí)間設(shè)置多種方法
這篇文章主要為大家詳細(xì)介紹了ASP.NET頁(yè)面請(qǐng)求超時(shí)時(shí)間設(shè)置Server.ScriptTimeOut executionTimeout多種方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-09-09asp.net AjaxControlToolKit--TabContainer控件的介紹
ModalPopup控件允許一個(gè)asp頁(yè)面的部分內(nèi)容以對(duì)話(huà)框的模式顯示給用戶(hù),同時(shí)會(huì)限制用戶(hù)于頁(yè)面的其他部分交互。對(duì)話(huà)框顯示的內(nèi)容可以是一個(gè)層級(jí),這個(gè)層級(jí)的背景可以使用戶(hù)自定義的格式,簡(jiǎn)單的理解好比是一個(gè)對(duì)話(huà)框彈出來(lái)后,主頁(yè)面會(huì)顯示灰色,且不可操作。2009-06-06關(guān)于EF的Code?First的使用以及踩坑記錄
這篇文章主要介紹了關(guān)于EF的Code?First的使用以及踩坑記錄,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-11-11