XML is a standard extension language and the standard for future web programming. Asp is one of the widely circulated web programming languages now. Can the two of them work together? Tofu is here to provide you with a very simple example. Regarding XML and XSL, due to limited space and knowledge level, Tofu is not ugly here. Let’s first talk about the content of a few files that need to be used.
:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http:///TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="PERSONNEL/PERSON">
<xsl:choose>
<xsl:when match=".[FG='boy']">
<input type="text">
<xsl:attribute name="value">
<xsl:value-of select="NAME"/>
</xsl:attribute>
</input>
<br/>
</xsl:when>
<xsl:otherwise match=".[FG='girl']">
<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>
:
<?xml version="1.0" encoding="gb2312" ?>
<PERSONNEL>
<PERSON>
<NAME>Male</NAME>
<FG>boy</FG>
</PERSON>
<PERSON>
<NAME>Female</NAME>
<FG>girl</FG>
</PERSON>
<PERSON>
<NAME>Haha, this is hard to say</NAME>
<FG>donot know</FG>
</PERSON>
</PERSONNEL>
<%
set xml = ("")
= false
((""))
set xsl = ("")
= false
((""))
((xsl))
%>
Compared with this example, let’s mainly talk about the document
set xml = ("")
set xsl = ("")
Used to create an instance of xml and xsl respectively, where (("")) is used to load
The xml file containing data, (("")) is used to load the xsl containing data rules.
File, finally use (xsl) to use the previous rules in XML files.
:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http:///TR/WD-xsl">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="PERSONNEL/PERSON">
<xsl:choose>
<xsl:when match=".[FG='boy']">
<input type="text">
<xsl:attribute name="value">
<xsl:value-of select="NAME"/>
</xsl:attribute>
</input>
<br/>
</xsl:when>
<xsl:otherwise match=".[FG='girl']">
<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>
:
<?xml version="1.0" encoding="gb2312" ?>
<PERSONNEL>
<PERSON>
<NAME>Male</NAME>
<FG>boy</FG>
</PERSON>
<PERSON>
<NAME>Female</NAME>
<FG>girl</FG>
</PERSON>
<PERSON>
<NAME>Haha, this is hard to say</NAME>
<FG>donot know</FG>
</PERSON>
</PERSONNEL>
<%
set xml = ("")
= false
((""))
set xsl = ("")
= false
((""))
((xsl))
%>
Compared with this example, let’s mainly talk about the document
set xml = ("")
set xsl = ("")
Used to create an instance of xml and xsl respectively, where (("")) is used to load
The xml file containing data, (("")) is used to load the xsl containing data rules.
File, finally use (xsl) to use the previous rules in XML files.