Home Backend Development XML/RSS Tutorial Implementing instance parsing of interaction between Asp and XML

Implementing instance parsing of interaction between Asp and XML

Apr 21, 2017 am 10:49 AM
asp xml interaction

XML is a standard extension language and the standard for future Web programming. ASP is one of the most popular web programming languages. Can they be combined to play a role? Tofu is here to provide you with a very simple source example of interaction between Asp and XML. Regarding XML and XSL, due to the limited space and knowledge level, Tofu will not show off here. First, let’s talk about the contents of several files that need to be used.
testXsl.xsl:

The code is as follows:

<?xml version=&#39;1.0&#39;?>   
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>   
<xsl:template match="/">   
<html>   
<body>   
<xsl:for-each select="PERSONNEL/PERSON">   
<xsl:choose>   
<xsl:when match=".[FG=&#39;boy&#39;]">   
<input type="text">   
<xsl:attribute name="value">   
<xsl:value-of select="NAME"/>   
</xsl:attribute>   
</input>   
<br/>   
</xsl:when>   
<xsl:otherwise match=".[FG=&#39;girl&#39;]">   
<font color="red"><li><xsl:value-of select="NAME"/></li></font>   
<br/>   
</xsl:otherwise>   
<xsl:otherwise>   
<font color="blue"><xsl:value-of select="NAME"/></font>   
</xsl:otherwise>   
</xsl:choose>   
</xsl:for-each>   
</body>   
</html>   
</xsl:template>   
</xsl:stylesheet>
Copy after login

testXML.xml:

The code is as follows:

<?xml version="1.0" encoding="gb2312" ?>   
<PERSONNEL>   
<PERSON>   
<NAME>男性</NAME>   
<FG>boy</FG>   
</PERSON>   
<PERSON>   
<NAME>女性</NAME>   
<FG>girl</FG>   
</PERSON>   
<PERSON>   
<NAME>呵呵,这个可不好说</NAME>   
<FG>donot know</FG>   
</PERSON>   
</PERSONNEL>
Copy after login

testXML.asp

The code is as follows:

<%   
set xml = Server.CreateObject("Microsoft.XMLDOM")   
xml.async = false   
xml.load(server.mappath("testXML.xml"))   
set xsl = Server.CreateObject("Microsoft.XMLDOM")   
xsl.async = false   
xsl.load(server.mappath("testXSL.xsl"))   
Response.Write(xml.transformNode(xsl))  
%>
Copy after login

Contrast this example, let’s mainly talk about testXML. asp file
set xml = Server.CreateObject("Microsoft.XMLDOM")
set xsl = Server.CreateObject("Microsoft.XMLDOM")
Used to create an instance of xml and xsl respectively, where xml .load(server.mappath("testXML.xml")) is used to load
xml files containing data, xsl.load(server.mappath("testXSL.xsl")) is used to load xsl containing data rules
file, finally use xml.transformNode(xsl) to use the previous rules in the XML file.

The above is the detailed content of Implementing instance parsing of interaction between Asp and XML. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Can I open an XML file using PowerPoint? Can I open an XML file using PowerPoint? Feb 19, 2024 pm 09:06 PM

Can XML files be opened with PPT? XML, Extensible Markup Language (Extensible Markup Language), is a universal markup language that is widely used in data exchange and data storage. Compared with HTML, XML is more flexible and can define its own tags and data structures, making the storage and exchange of data more convenient and unified. PPT, or PowerPoint, is a software developed by Microsoft for creating presentations. It provides a comprehensive way of

Convert XML data to CSV format in Python Convert XML data to CSV format in Python Aug 11, 2023 pm 07:41 PM

Convert XML data in Python to CSV format XML (ExtensibleMarkupLanguage) is an extensible markup language commonly used for data storage and transmission. CSV (CommaSeparatedValues) is a comma-delimited text file format commonly used for data import and export. When processing data, sometimes it is necessary to convert XML data to CSV format for easy analysis and processing. Python is a powerful

Turn on split-screen interaction in win11 Turn on split-screen interaction in win11 Dec 25, 2023 pm 03:05 PM

In the win11 system, we can enable multiple monitors to use the same system and operate together by turning on split-screen interaction. However, many friends do not know how to turn on split-screen interaction. In fact, just find the monitor in the system settings. The following is Get up and study. How to open split-screen interaction in win11 1. Click on the Start menu and find "Settings" 2. Then find the "System" settings there. 3. After entering the system settings, select "Display" on the left. 4. Then select "Extend these displays" in the multi-monitor on the right.

Vue3+TS+Vite development skills: how to interact with the backend API Vue3+TS+Vite development skills: how to interact with the backend API Sep 08, 2023 pm 06:01 PM

Vue3+TS+Vite development skills: How to interact with the back-end API Introduction: In web application development, data interaction between the front-end and the back-end is a very important link. As a popular front-end framework, Vue3 has many ways to interact with back-end APIs. This article will introduce how to use the Vue3+TypeScript+Vite development environment to interact with the back-end API, and deepen understanding through code examples. 1. Use Axios to send requests. Axios is

How to handle XML and JSON data formats in C# development How to handle XML and JSON data formats in C# development Oct 09, 2023 pm 06:15 PM

How to handle XML and JSON data formats in C# development requires specific code examples. In modern software development, XML and JSON are two widely used data formats. XML (Extensible Markup Language) is a markup language used to store and transmit data, while JSON (JavaScript Object Notation) is a lightweight data exchange format. In C# development, we often need to process and operate XML and JSON data. This article will focus on how to use C# to process these two data formats, and attach

Using Python to implement data verification in XML Using Python to implement data verification in XML Aug 10, 2023 pm 01:37 PM

Using Python to implement data validation in XML Introduction: In real life, we often deal with a variety of data, among which XML (Extensible Markup Language) is a commonly used data format. XML has good readability and scalability, and is widely used in various fields, such as data exchange, configuration files, etc. When processing XML data, we often need to verify the data to ensure the integrity and correctness of the data. This article will introduce how to use Python to implement data verification in XML and give the corresponding

How Python parses XML files How Python parses XML files Aug 09, 2023 am 11:48 AM

How Python parses XML files XML (eXtensibleMarkupLanguage) is a markup language used to represent structured data. When processing XML data, we often need to parse the XML file to extract the required information. Python provides many libraries and modules to parse XML files, such as ElementTree, lxml, etc. This article will introduce how to use Python to parse XML files, with code examples. In Python,

How to use PHP functions to process XML data? How to use PHP functions to process XML data? May 05, 2024 am 09:15 AM

Use PHPXML functions to process XML data: Parse XML data: simplexml_load_file() and simplexml_load_string() load XML files or strings. Access XML data: Use the properties and methods of the SimpleXML object to obtain element names, attribute values, and subelements. Modify XML data: add new elements and attributes using the addChild() and addAttribute() methods. Serialized XML data: The asXML() method converts a SimpleXML object into an XML string. Practical example: parse product feed XML, extract product information, transform and store it into a database.

See all articles