【发布时间】:2017-11-23 12:39:10
【问题描述】:
我在 xsl 文件中有数千个这样的 xsl 模板。
<xsl:template name="foo">
...
...
</xsl:template>
<xsl:template match="bar" > <!-- ending spaces after quote -->
...
...
</xsl:template>
我的工作是在这里添加相同的命名空间。 更改后的 xsl 看起来像
<xsl:template name="foo" xmlns="http://example.org">
...
...
</xsl:template>
<xsl:template match="bar" xmlns="http://example.org" >
...
...
</xsl:template>
这是我的方法
1.标记所有以<xsl:template开头的行
2.在标记的行上添加正则表达式。
我坚持第 2 点。我怎样才能只在标记的行上应用一些正则表达式?
你有什么更好的办法吗?
更新
我的挑战是仅在标记线上将所有> 替换为xmlns="http://example.org">。
【问题讨论】:
-
为什么不将
<xsl:template name="foo">替换为纯文本:<xsl:template name="foo" xmlns="http://example.org">? -
如果我有一个
foo来改变那会是明智的吗?我还需要处理Bar。还有很多.. -
好的,现在任务很明确了。 问题是什么?
-
@WiktorStribiżew 这个问题解决了我认为的任务