Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml xslt查找字符串中文本的精确匹配_Xml_Xslt 1.0_Xslt 2.0 - Fatal编程技术网

Xml xslt查找字符串中文本的精确匹配

Xml xslt查找字符串中文本的精确匹配,xml,xslt-1.0,xslt-2.0,Xml,Xslt 1.0,Xslt 2.0,我需要找出文本字符串是否包含关键字,然后将关键字设为粗体。它应该与搜索的关键字完全匹配,而不是与包含该关键字的单词匹配 e、 g(使用XSLT1.0): 在文本“当前情况”中搜索“当前”的关键字应匹配,但在“研讨会演示”中不应匹配“当前” 这是一个xsl片段-问题是,当在param“mystring”中查找“present”时,它与“presentation”匹配,该参数等于“对于研讨会演示,这很好” <xsl:variable name="keywordList"> &

我需要找出文本字符串是否包含关键字,然后将关键字设为粗体。它应该与搜索的关键字完全匹配,而不是与包含该关键字的单词匹配

e、 g(使用XSLT1.0): 在文本“当前情况”中搜索“当前”的关键字应匹配,但在“研讨会演示”中不应匹配“当前”

这是一个xsl片段-问题是,当在param“mystring”中查找“present”时,它与“presentation”匹配,该参数等于“对于研讨会演示,这很好”

  <xsl:variable name="keywordList">
    <Keywords>
      <Keyword>present</Keyword>
      <Keyword>random</Keyword>
     </Keywords>
  </xsl:variable>

    <xsl:variable name="KeywordsToFind" select="msxsl:node-set($keywordList)/Keywords/Keyword" />

  <xsl:call-template name="BoldKeywords">
      <xsl:with-param name="mystring" select="."/>

//Recursive template
    <xsl:template name="BoldKeywords">
    <xsl:param name="mystring"/>
    <xsl:param name="keywords" select="$KeywordsToFind"/>
    <xsl:variable name="keyword" select="$keywords[contains($mystring,.)][1]"/>
//Make keyword bold
    </xsl:template>

目前
随机的
//递归模板
//使关键字加粗
谢谢你的帮助。

1。如果您使用的是XSLT1.0,那么为什么您的问题被标记为XSLT2.0?2.我看不到你代码的有效部分。3.在XSLT1.0中很难做到这一点,因为它没有单词本身的概念。如果单词之间总是用空格分隔,那么您可以在搜索字符串中包含空格;否则,您将不得不预测所有可能的标点符号。1。如果您使用的是XSLT1.0,那么为什么您的问题被标记为XSLT2.0?2.我看不到你代码的有效部分。3.在XSLT1.0中很难做到这一点,因为它没有单词本身的概念。如果单词之间总是用空格分隔,那么您可以在搜索字符串中包含空格;否则,您将不得不预测所有可能的标点符号。