SAP ABAP实用技巧介绍系列之 ABAP XSLT match keyword
SAP 介绍 系列 ABAP 实用技巧 match keyword XSLT
2023-09-14 09:02:51 时间
Created by Jerry Wang, last modified on Jun 26, 2014
用于测试的xml:
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
</catalog>
在tcode strans创建的xslt program:
<?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>My CD Collection</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
match = “/” 意为匹配整个xml document:
测试输出:
输出结果来自xslt里manual 指定的h2 tag 以及匹配的整个xml document中每个节点的value,但不包含节点名称本身。
如果把match = “/”替换成 match = “title”:
输出如下, 因此此时有两个匹配的title node。
match=“catalog”: 效果如/
match=“cd”: 效果如match = “title”
match=“artist”: 找不到匹配的document,输出为空:
但如果先匹配整个document,再匹配artist node则可成功:
输出如下:
match="/catalog/cd": 输出同match=“cd”
match="/catalog/cd/title": 输出同上
match="/catalog/cd/artist": 输出为空
match=“artist[parent::cd]”>: 输出为空
输入如下:
[外链图片转存失败(img-U8zlk8Ac-1562210924325)(https://user-images.githubusercontent.com/5669954/27290940-0274646e-550f-11e7-9d3c-f2417d434d58.png)]
输出:
match="*":
每个节点都会生成一个h2 node:
相关文章
- 154. SAP UI5 Smart Table 和 Smart Filter Bar 的联合使用方法介绍
- 110. SAP UI5 FileUploader 控件深入介绍 - 为什么需要一个隐藏的 iframe
- 83. SAP UI5 的自动化测试套件页面的开发步骤介绍
- SAP UI5 SmartTable 控件的使用介绍试读版
- SAP CDS view单元测试框架中的访问者(Visitor)设计模式使用介绍
- SAP ABAP实用技巧介绍系列之Internal table compression and decompression
- SAP ABAP实用技巧介绍系列之使用代码获得某个structure上的扩展字段
- SAP ABAP实用技巧介绍系列之ABAP取中文字符串的字节长度
- SAP ABAP实用技巧介绍系列之 ABAP内存管理学习
- SAP ABAP实用技巧介绍系列之 关于View framework处理Before save event的讨论
- SAP ABAP实用技巧介绍系列之 获得webservice的schema node
- SAP ABAP SE16 and SE17
- SAP ABAP实用技巧介绍系列之 ABAP XSLT 使用attribute增加新的属性
- SAP ABAP实用技巧介绍系列之 使用simple transformation的mapping功能
- 在SAP C4C创建销售订单时如何绑定创建者的微信open id
- SAP Kyma能像SAP BYD那样做field extension吗
- SAP 云平台多目标应用 Multi-Target Application 的开发技术介绍
- SAP S4CRM 1811 服务订单API介绍
- SAP UI5 视图里的 OverflowToolbar 控件
- SAP UI5 初学者教程之二十八 - SAP UI5 应用的集成测试工具 OPA 介绍试读版
- SAP UI5 初学者教程之二十七 - SAP UI5 应用的单元测试工具 QUnit 介绍试读版
- SAP Fiori Elements原理介绍之类型为Currency的Smart Field工作原理