XSLT(extensible stylesheet language transformation) transform one xml document to another which have been decorated completed。XSL usually include XSLT,XPATH,XSL-FO .
we usually use the <xsl:stylesheet> tag to define the xsl document.
use the <xsl:template> tag to difine a template.
use the <xsl:value-of> tag to select value ,the attribute "select" is expression of XPATH ,use it to locate the value.
use the <xsl:for-each> tag to loop each value in xml.
<xsl:sort select="**"/> sort value according to the special value in "select"
<xsl:if test="**"> is a condition express use to filter value in xml
<xsl:choose> <xsl:when test="expression"> ... 输出 ... </xsl:when> <xsl:otherwise> ... 输出 .... </xsl:otherwise></xsl:choose> use to filter value when you are in "if" and "else" situation.
if your browser can support xslt then xslt can transfort xml document to xhtml in the browser.
we can transform xml to xhtml use JAVASCRIPT:
<script type="text/javascript">
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = falsexml.load("cdcatalog.xml")
xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = falsexsl.load("cdcatalog.xsl")
// Transform
document.write(xml.transformNode(xsl))
</script>
we can transform xml to xhtml in server:
<%
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("cdcatalog.xml"))'
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = falsexsl.load(Server.MapPath("cdcatalog.xsl")
Response.Write(xml.transformNode(xsl))%>