TestXML.xml <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:template match="/"><html><body> <xsl:for-each select="PERSONNEL/PERSON"> <xsl:value-of select="NAME"/> <xsl:choose> <xsl:when test="./FG = 'boy'"> <input type="text"> <xsl:attribute name="value"> <xsl:value-of select="NAME"/> </xsl:attribute> </input> <br/> </xsl:when> <xsl:when test="./FG = 'girl'"> <font color="red"><li><xsl:value-of select="NAME"/></li></font> <br/> </xsl:when> <xsl:otherwise> <font color="blue"><xsl:value-of select="NAME"/></font> </xsl:otherwise> </xsl:choose> </xsl:for-each></body></html></xsl:template></xsl:stylesheet> TestXML.xsl <PERSONNEL><PERSON><NAME>MALE</NAME><FG>boy</FG></PERSON><PERSON><NAME>FEMALE</NAME><FG>girl</FG></PERSON><PERSON><NAME>DO NOT KNOW</NAME><FG>donot know</FG></PERSON></PERSONNEL> TestXML.asp <%Set xml=Server.CreateObject("Microsoft.XMLDOM")xml.async = falsexml.load server.mappath("TestXML.xml")set xsl = Server.CreateObject("Microsoft.XMLDOM")xsl.async = falsexsl.load(server.mappath("testXML.xsl"))xml.transformNodeToObject xsl, Response 'Response.Write xml.transformNode(xsl)%> 相关文章: