.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)航列表 來訪員工=''>
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='設(shè)計(jì)計(jì)劃' 站點(diǎn)編號='EPM' 站點(diǎn)鏈接='../NWEPDI.EPM.WEB/../Project/ProjectList.aspx?QueueType=EPM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='設(shè)計(jì)作業(yè)' 站點(diǎn)編號='DDM' 站點(diǎn)鏈接='../MoEngineer/ProjectMgr.aspx' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='設(shè)計(jì)流程' 站點(diǎn)編號='DFM' 站點(diǎn)鏈接='../MoFlow/CWorkItemList.aspx?QueueType=DFM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='印務(wù)管理' 站點(diǎn)編號='PPM' 站點(diǎn)鏈接='../MoPrint/PrintMgr.aspx?QueueType=PPM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='工時(shí)管理' 站點(diǎn)編號='WHM' 站點(diǎn)鏈接='../MoWorkHour/HourMgrPrj.aspx?QueueType=WHM0103' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='電子歸檔' 站點(diǎn)編號='ARC' 站點(diǎn)鏈接='../MoArchieve/ProjectMgr.aspx?QueueType=ARC0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='統(tǒng)計(jì)報(bào)表' 站點(diǎn)編號='SSM' 站點(diǎn)鏈接='../MoReports/ReportView.aspx?QueueType=SSM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='資料管理' 站點(diǎn)編號='DAM' 站點(diǎn)鏈接='../MoDocument/ProjectFileMgr.aspx?QueueType=DAM0101' />
<站點(diǎn)導(dǎo)航 站點(diǎn)名稱='系統(tǒng)管理' 站點(diǎn)編號='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)名稱"/>
<xsl:attribute name="id">
<xsl:value-of select="@站點(diǎn)編號"/>
</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)文章
值得收藏的asp.net基礎(chǔ)學(xué)習(xí)筆記
這篇文章主要分享了一份值得大家收藏的asp.net基礎(chǔ)學(xué)習(xí)筆記,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-09-09
.net c# gif動畫如何添加圖片水印實(shí)現(xiàn)思路及代碼
本文將詳細(xì)介紹下c#實(shí)現(xiàn)gif動畫添加圖片水印,思路很清晰,感興趣的你可以參考下哈,希望可以幫助到你2013-03-03
詳解ASP.NET提取多層嵌套json數(shù)據(jù)的方法
本篇文章主要介紹了ASP.NET提取多層嵌套json數(shù)據(jù)的方法,利用第三方類庫Newtonsoft.Json提取多層嵌套json數(shù)據(jù)的方法,有興趣的可以了解一下。2017-02-02
ASP.NET打開新頁面而不關(guān)閉原來的頁面 實(shí)例代碼
這篇文章介紹了ASP.NET打開新頁面而不關(guān)閉原來的頁面 實(shí)例代碼,有需要的朋友可以參考一下,希望對你有所幫助2013-07-07
asp.net中在用ajax格式傳遞數(shù)據(jù)到aspx頁面時(shí)出現(xiàn)亂碼
asp.net中在用ajax格式傳遞數(shù)據(jù)到aspx頁面時(shí)有時(shí)會出現(xiàn)亂碼,很是疑惑,不要走開接下來介紹解決方法,感興趣的朋友可以了解下2013-01-01
.NET 8 中如何利用 MediatR 實(shí)現(xiàn)高效消息傳遞
這篇文章主要介紹了.NET 8 中利用 MediatR 實(shí)現(xiàn)高效消息傳遞,示例不僅說明了如何使用MediatR?來處理通知,還說明了如何實(shí)現(xiàn)通知處理模式,需要的朋友可以參考下2024-08-08
使用母版頁時(shí)內(nèi)容頁如何使用css和javascript
由于網(wǎng)站的主要頻道頁和列表頁的頭部和底部都是一樣的,如果將每個(gè)頁面放在單獨(dú)的頁面中,當(dāng)頭部和底部需要更改時(shí)維護(hù)量太大。于是想把頭部和底部做成母版頁,頻道頁和列表頁的具體內(nèi)容放到內(nèi)容頁中。這樣當(dāng)頭和底需要改動時(shí),只要修改一下母版頁就可以了。2009-08-08
ASP.NET MVC5+EF6+EasyUI 后臺管理系統(tǒng)(81)-數(shù)據(jù)篩選(萬能查詢)實(shí)例
本篇文章主要介紹了ASP.NET MVC5+EF6+EasyUI 后臺管理系統(tǒng)(81)-數(shù)據(jù)篩選(萬能查詢) ,具有一定的參考價(jià)值,有興趣的可以了解一下。2016-12-12
詳解如何在ASP.NET Core中應(yīng)用Entity Framework
本篇文章主要介紹了如何在ASP.NET Core中應(yīng)用Entity Framework,具有一定的參考價(jià)值,有興趣的可以一起了解一下。2016-12-12
asp.net(C#)實(shí)現(xiàn)功能強(qiáng)大的時(shí)間日期處理類完整實(shí)例
這篇文章主要介紹了asp.net(C#)實(shí)現(xiàn)功能強(qiáng)大的時(shí)間日期處理類,封裝了針對日期與時(shí)間的各種常用的判斷與計(jì)算功能,非常方便實(shí)用,需要的朋友可以參考下2016-06-06

