Skip to main content

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Applying a Style Sheet to an XML Document

A style sheet object that passes into the transformNode method needs to be recompiled every time the method is called. Compiling a style sheet means setting all its template rules in an executable state. By using the XSLTemplate object and the XSLProcessor object to perform transformation facilitates  the reduction of overheads and increases the performance of an XSLT application.

The XSLTemplate Object


The XSLTemplate object is a dom object that is used to access an XSLT style sheet. This object is used to hold a cached style sheet that can then be dynamically associated with an XML document.

Before a style document can be applied to an XML document, it is converted into a tree structure by the parser. In the early versions of MSXML, the style sheet had to be compiled each time it was required for processing an XML document. In other words, the tree structure for a style sheet had to be recreated for the use of XSL document, as the compiled version was not stored in the system. This resulted in a longer processing time. However, in MSXML 2.6 and later, a compiled version of the XSLT document is stored in the cache memeory of the computer. This means that the XSLT tree is created the first time the document is compiled. For each successive use of the style sheet, the compiled version is reused.

The XSLT tree structure is loaded into the memory of the computer and used to process the XML document. This is because the XSLTemplate object stores the compiled XSLT document. Therefore, you must first create an XSLTemplate object. In the following example, an XSLTemplate object called xsltobj is created using JavaScript:

           xsltobj= new ActiveXObject ("MSXML2.XSLTemplate . 6 . 0") ;

This object must be associated with an XSLT style sheet document. Consider the following code snippet:

          var xsldocobj= new  ActiveXObject ("Msxm12.freeThreadedDOMDocument . 6 . 0") ;
           xsldocobj . load ("products . xsl") ;
           xsltobj . stylesheet=xsldocobj ;

In the preceding example, an instance of the FreeThreaded DOMDocument object is created. This object can be used to access an XML document as well as an XSLT style sheet. This is because XSLT is an application of XML. The load () method of the FreeThreaded DOMDocument object is used to associate the XSL document products.xsl with the xsldocobj object. The stylesheet property of the xsltobj object is then used to associate the XSLTemplate object with the object that holds the XSL document.

The XSLProcessor Object


To process an XML document by using a style sheet, you must create an instance of the XSLProcessor object. This object is used to apply a style sheet to an XML document and then process that document. The XSLProcessor object is supported only in IE 5.0 and higher versions.

The XSLProcessor object applies the given XSLT document to a specifc XML document. In other words, this object transforms an XML document by using the XSLT style sheet. For example, an XML document can be transformed into an HTML document by applying the appropriate XSLT style sheet by using XSLProcessor object.

The JavaScript code to create an XSLProcessor object is as follows:

        var  xsalprocobj= xsltobj.createProcessor ( ) ;

In this example, the createProcessor ( ) method is used to create a new XSLProcessor object called xslprocobj. The createProcessor ( ) method is called by xsltobj, which represents a cached version of a compiled XSLT template. The xsltobj object is associated with a specific style sheet contained in the variable xsldocobj.

You can then create the XML document for which the style sheet contained in the xsltobj object must be applied. Consider the following example:

        var xmldocobj = new ActiveXObject ("Msxm12 . DOMDocument . 6 . 0") ;
        xmldocobj . load ("products . xml") ;

In the example, a new DOMDocument object called xmldocobj is created. The load ( ) method of this object is used to associate an XML document called products . xml with this object. This XML document is then passed to the XSLProcessor object as an input by using the input property. This property is used to specify the XML tree that must be transformed, as follows:

        xslprocobj . input=xmldocobj ;

The transform ( ) method of the XSLProcessor object is then invoked. This method performs the transformation of an XML document. During transformation, the tree structures of the XML and XSLT documents are used as input. The XSLT tree is applied to the XML tree and the document is then processed. The output of this process is an XML document that is rendered in the manner specified in the XSLT document. Consider the following example:

       xslprocobj . transform ( ) ;

In the preceding example, the transform ( ) method of the XSLProcessor object is invoked. The transform() method can be called multiple times for an XML Document to transform the different sections of the XML document.. The result of the transform ( ) method is displayed using the output property of the XSLProcessor object. The output can be displayed in a browser window or a message box. Consider the following example:

      alert (xslprocobj . output ) ;

In this example, the alert ( ) method is used to display the data stored in the transformed XML document in a message box.

Comments

Popular Post

Polynomial representation using Linked List for Data Structure in 'C'

Polynomial representation using Linked List The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows: Polynomial:      3x 3 -4x 2 +2x-9 Linked List: In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable. Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Memory representation of Linked List Data Structures in C Language

                                 Memory representation of Linked List              In memory the linked list is stored in scattered cells (locations).The memory for each node is allocated dynamically means as and when required. So the Linked List can increase as per the user wish and the size is not fixed, it can vary.                Suppose first node of linked list is allocated with an address 1008. Its graphical representation looks like the figure shown below:       Suppose next node is allocated at an address 506, so the list becomes,   Suppose next node is allocated with an address with an address 10,s the list become, The other way to represent the linked list is as shown below:  In the above representation the data stored in the linked list is “INDIA”, the information part of each node contains one character. The external pointer root points to first node’s address 1005. The link part of the node containing information I contains 1007, the address of