xsl substring-after usage

gen*_*cay 3 xslt

我有这个XSL代码,我想配置字符串.但是我还没有得到配置的字符串.可能是什么事?

<xsl:param name="topicId"></xsl:param>
<xsl:param name="topicName"/>

 <xsl:attribute-set name="attrTopic">
  <xsl:attribute name="id">
  <xsl:value-of select="/message/file/@name[substring-after($topicId,'-')]"/>
  </xsl:attribute>
 <xsl:attribute name="name">
<xsl:value-of select="/message/file/@name[substring-before(' ',$topicId)]"/>
 </xsl:attribute>
  </xsl:attribute-set>
<xsl:attribute-set name="attrVars">
</xsl:attribute-set>
Run Code Online (Sandbox Code Playgroud)

$ topicId来自我的Java文件.总之,我试图在XSL中将此字符串"1010-Text"分别转换为"1010"和"Text"

Emi*_*ggi 11

如果上下文是正确的$topicId='WordA-WordB'

substring-after($topicId,'-')
Run Code Online (Sandbox Code Playgroud)

应该得到WordB和

substring-before(' ',$topicId)
Run Code Online (Sandbox Code Playgroud)

什么都不会.

而

substring-before($topicId,'-')
Run Code Online (Sandbox Code Playgroud)

得到WordA.