My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and ...

Render(Parse) XML using XSLT

Requirement:
The requirement is to render xml data into a page.
Resolution:
We can perform this task by following ways:
1. Read xml file using C#.Net and iterate the xml node. At the time of iteration, render data from xml to page.
2. Use the XSL. In this approach, create .XSLT file, which store the formatting in the form of HTML/CSS. By using XSL, we can separate the data rending from the data itself.
Example to render (parse) xml using xslt:
Save given xml in to file called "myNavigation.xslt":



  
    
  



Now add following tag in your .ASPX page:


In the code behind file of .ASPX page (.ASPX.CS file), add following directive:
using System.Xml;
using System.Xml.Xsl;

After that,in the code behind file of .ASPX page (.ASPX.CS file), write following code in the Page_Load method:

string languageDetails =
 @"
    
        
            
                
                
                
            
            
                
                
            
            
            
            
                
                
                
                
                
              
            
            
              
            
        
      ";
XmlDocument myNavigationDoc = new XmlDocument();
myNavigationDoc.LoadXml(languageDetails);

XslTransform myNavigationTransform = new XslTransform();
myNavigationTransform.Load(Server.MapPath("myNavigation.xslt"));

this.myNavigationControl.Document = myNavigationDoc;
this.myNavigationControl.Transform = myNavigationTransform;

Comments

Unknown said…
I have been following you for a couple of months now but this is my first time commenting on a blog post. Thank you for sharing your knowledge and experience with us. Keep up the good work. Already bookmarked for future reference.
Hadoop Training in Chennai
Hadoop Training
Best Hadoop Training in Chennai
Best Hadoop Training Institute in Chennai

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Manager Cloud (XM Cloud) Building blocks

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container