阅读602 返回首页    go 阿里云 go 技术社区[云栖]


XSLT的处理模型(1)

HelloWorld程序

1.helloworld.xml文件

<?xml version="1.0" encoding="gb2312" ?> <?xml-stylesheet type="text/xsl" href="hellowold.xslt"?> <root> <name>zhangqs008</name> <name>清山</name> </root> 
注意:如果有中文编码,请指定为encoding="gb2312" 方式。

2.被关联的样式表:helloworld.sxlt

<?xml version="1.0" encoding="gb2312" ?> <xsl:stylesheet version="1.0" xmlns:xsl="https://www.w3.org/1999/XSL/Transform"> <xsl:template match="/root"> <html> <title>this is my first xslt programm</title> <body> <xsl:for-each select="name"> <xsl:text>Hello world,This is </xsl:text> <xsl:value-of select="." /> <xsl:text> Speaking</xsl:text> <br /> <br /> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> 

3.在应用了上述的XSLT文档以后,原来的XML文档转换为如下的HTML代码:

 

<html> <title>this is my first xslt programm</title> <body>Hello world,This is zhangqs008 Speaking<br><br>Hello world,This is 清山Speaking<br><br></body> </html> 

最后更新:2017-04-02 06:51:22

  上一篇:go tomcat 5.5 Cannot create JDBC driver of class &#39;&#39; for connect URL &#39;null&#39; 配置数据源错误解决办法
  下一篇:go 恢复任务栏显示桌面快捷方式