本文概述
- 参数说明
- XSLT < xsl:value-of> 元素示例
<
xsl:value-of
select = Expression
disable-output-escaping = "yes" | "no">
<
/xsl:value-of>
参数说明
Index | Name | Description |
---|---|---|
1) | select | 它指定要在当前上下文中评估的XPpath表达式。 |
2) | disable-outputescaping | 默认值-“ 否” 。如果为” 是” , 则输出文本不会从文本中转义XML字符。 |
employee.xml
<
?xml version = "1.0"?>
<
?xml-stylesheet type = "text/xsl" href = "http://www.srcmini.com/employee.xsl"?>
<
class>
<
employee id = "001">
<
firstname>
Aryan<
/firstname>
<
lastname>
Gupta<
/lastname>
<
nickname>
Raju<
/nickname>
<
salary>
30000<
/salary>
<
/employee>
<
employee id = "024">
<
firstname>
Sara<
/firstname>
<
lastname>
Khan<
/lastname>
<
nickname>
Zoya<
/nickname>
<
salary>
25000<
/salary>
<
/employee>
<
employee id = "056">
<
firstname>
Peter<
/firstname>
<
lastname>
Symon<
/lastname>
<
nickname>
John<
/nickname>
<
salary>
10000<
/salary>
<
/employee>
<
/class>
员工.xsl
<
?xml version = "1.0" encoding = "UTF-8"?>
<
xsl:stylesheet version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">
<
xsl:template match = "/">
<
html>
<
body>
<
h2>
Employee<
/h2>
<
table border = "1">
<
tr bgcolor = "purple">
<
th>
ID<
/th>
<
th>
First Name<
/th>
<
th>
Last Name<
/th>
<
th>
Nick Name<
/th>
<
th>
Salary<
/th>
<
/tr>
<
!-- for-each processing instruction
Looks for each element matching the XPath expression
-->
<
xsl:for-each select="class/employee">
<
tr>
<
td>
<
!-- value-of processing instruction
process the value of the element matching the XPath expression
-->
<
xsl:value-of select = "@id"/>
<
/td>
<
td>
<
xsl:value-of select = "firstname"/>
<
/td>
<
td>
<
xsl:value-of select = "lastname"/>
<
/td>
<
td>
<
xsl:value-of select = "nickname"/>
<
/td>
<
td>
<
xsl:value-of select = "salary"/>
<
/td>
<
/tr>
<
/xsl:for-each>
<
/table>
<
/body>
<
/html>
<
/xsl:template>
<
/xsl:stylesheet>
输出
文章图片
推荐阅读
- XSLT xsl(for-each元素)
- XSLT语法用法示例
- XQuery正则表达式
- 什么是XSLT
- XQuery If Then Else语句
- Android学习—— Android studio的安装与配置
- Error:No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android(示
- AndroidStudio不重新运行,Debug调试已有进程
- flask基础之AppContext应用上下文和RequestContext请求上下文