Small example of using the xsl file as the navigation menu in. net

Source: Internet
Author: User

Copy codeThe Code is as follows: <% @ 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 = @ "<site navigation list of visiting employees =''>
<Site navigation site name = 'Design scheduler 'site no. = 'pem' site link =' ../NWEPDI. pem. WEB/../Project/ProjectList. aspx? QueueType = EPM0101 '/>
<Site navigation site name = 'Design job' site no. = 'ddm' site link = '../MoEngineer/ProjectMgr. aspx'/>
<Site navigation site name = 'Design process' site number = 'dfm 'site link =' ../MoFlow/CWorkItemList. aspx? QueueType = DFM0101 '/>
<Site navigation site name = 'print management' site no. = 'ppm 'site link =' ../MoPrint/PrintMgr. aspx? QueueType = PPM0101 '/>
<Site navigation site name = 'working hours management' site no. = 'whm' site link = '../MoWorkHour/HourMgrPrj. aspx? QueueType = WHM0103 '/>
<Site navigation site name = 'electronic archive 'site no. = 'arc' site link =' ../MoArchieve/ProjectMgr. aspx? QueueType = ARC0101 '/>
<Site navigation site name = 'statistical report' site no. = 'ssm' site link = '../MoReports/ReportView. aspx? QueueType = SSM0101 '/>
<Site navigation site name = 'data management' site no. = 'dam 'site link =' ../MoDocument/ProjectFileMgr. aspx? QueueType = DAM0101 '/>
<Site navigation site name = 'System management' site no. = 'dsm 'site link =' ../MoAdmin/CommonRuleList. aspx? QueueType = DSM0101 '/>
</Site navigation list> ";
}
}
}

<? 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 = "// site navigation list">
<Div>
<Ul>
<Li> navigation </li>
<Xsl: for-each select = "site navigation">
<Li>
<Xsl: value-of select = "@ site name"/>
<Xsl: attribute name = "id">
<Xsl: value-of select = "@ site no."/>
</Xsl: attribute>
<Xsl: attribute name = "href">
<Xsl: value-of select = "@ site Link"/>
</Xsl: attribute>
</Li>
</Xsl: for-each>
</Ul>
</Div>
</Xsl: template>
</Xsl: stylesheet>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.