开发者

xsl substring-after usage

开发者 https://www.devze.com 2023-03-12 05:33 出处:网络
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?

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

精彩评论

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

关注公众号