Convert XML data to HTML using XSLT

xiaoxiao2021-03-06  88

Use a simple XSL style sheet to convert XML data to HTML. With the continuous evolution of XML specification, it seems necessary to meet each person in the new version; unfortunately, simple conversion has always been plagued. Suppose I have an XML data representing a page content, now I want to convert its content into layout. Here is the XML: < Text> Folder 1 file 1 string 50 Some Data This content represents a set of folders, files and domains . Each folder contains files, each file contains domains for entering data. Each folder in the folder group will behave as a TR element of a TABLE's first row and a TD element. Each file in the file group will represent a TR element of the first row of a Table element nested in the folder TR element and a TD element. Each domain in the domain group will appear as an Input in the relevant file. In order to achieve this, we need to traverse XML then build a table according to XSL.

Here is the XSL: Function getElementCount (nodelist, what) {var RTRN = 0; RTRN = nodelist [0] .parentnode.selectnodes (what) .length; return (RTRN 1); // 1 IS Added for Filler TD} width: 55px

Border = "0" style = "Table-layout: fixed;">

Text <

转载请注明原文地址:https://www.9cbs.com/read-95775.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.041, SQL: 9