XSLT knowledge

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))%>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值