xslt - How do I search and remove text using XSLT?
问题描述
I need to search and remove this span <span property="atom:tag" class="ktp-meta">nclex_rn_qbank</span>
from the HTML below using XSLT. How would I do that?
My script is setup to only make this change on certain files, not all so I can't do a simple search and replace in all files.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" designation="" enumeration="">
<head>
<meta charset="utf-8" />
<link type="text/css" rel="stylesheet" title="default" href="../../assets/css/main.css" />
<title>n002001_ORG</title>
</head>
<body>
<ol class="ktp-question-set">
<li property="ktp:question" typeof="ktp:Question" class="ktp-question">
<section class="ktp-question-meta">
<section property="ktp:metadata" class="ktp-meta">
<span property="atom:content-item-name" class="ktp-meta"
data-value="n002001_ORG"></span>
</section>
<section property="ktp:tags" class="ktp-meta">
<span property="ktp:interactionType" class="ktp-meta">single-select</span>
<span property="atom:tag" class="ktp-meta">nursing</span>
<span property="atom:tag" class="ktp-meta">nclex_rn</span>
<span property="atom:tag" class="ktp-meta">nclex_rn_qbank</span>
</section>
</section>
</li>
</ol>
</body>
</html>
解决方案
你有没有试过这样:
<xsl:template match="span[@property='atom:tag' and @class='ktp-meta' and normalize-space(.) = 'nclex_rn_qbank']"/>
推荐阅读
- r - R:如何序列化堆中的 C/C++ 数据?
- sql-server - 哪些特性使 Oracle 和 SQL Server 数据库成为 ORDBMS?
- java - Google Oauth 登录窗口无法正常工作
- javascript - 我有两个
- c++ - 将精灵定位在 (0, 0) 会使精灵离开屏幕几个像素
- c# - TPL 数据流:取消
- jquery - 如何在模态照片库中制作上一个和下一个按钮
- scala - 无法使用功能 API 执行并行计算
- dart - 如何使用drawImageRect设置绘制到画布上的图像的不透明度?
- c# - 使用 LINQ 迭代两个集合以检查匹配属性的正确方法是什么?