开发者

xsl substring-after usage

I have this XSL code and I would like to configure the string. However I couldn't get the configured str开发者_StackOverflowing yet. What could be the matter?

<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>

$topicId comes from my Java file. in sum I am trying to convert this string "1010-Text" to "1010" and "Text" separately in XSL


If the context is correct and $topicId='WordA-WordB'

substring-after($topicId,'-')

should get WordB and

substring-before(' ',$topicId)

should get nothing.

While

substring-before($topicId,'-')

shoud get WordA.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜