【发布时间】:2012-06-06 19:19:46
【问题描述】:
我有这样的 XML:
<a>
<b>
<c>some text here</c>
</b>
</a>
<a>
<b>
<c>another cool text</c>
</b>
</a>
我需要在 //a/b/c/text() 中匹配单词“cool”并像这样转换 XML
<a>
<b>
<c>some text here</c>
</b>
</a>
<x>
<y> prepend to cool text </y>
</x>
<a>
<b>
<c>another cool text</c>
</b>
</a>
我试过了:
<xsl:template
match="//a/b/c/matches(text(),'\.*cool\*.')">
...
</xsl:template>
但没有运气:
XTSE0340: XSLT Pattern syntax error at char 153 on line 30 in {...\.*cool\*...}:
Function call may appear only at the start of a pattern
我在这里错过了什么?
【问题讨论】: