String xsl-我的代码中的字符串翻译-需要帮助

String xsl-我的代码中的字符串翻译-需要帮助,string,xslt,translate,replaceall,String,Xslt,Translate,Replaceall,我有一个xsl代码,需要像在Java中一样实现replaceAll功能。我试过了 trasnlate功能,但不起作用。我不知道在哪里以及如何使用下面代码中的函数,请对此提供帮助 <xsl:template match="warning"> <xsl:param name="drugsSub" select="'false'"/> <tr> <td class="dataRowBorderBottom rowColor" sty

我有一个xsl代码,需要像在Java中一样实现replaceAll功能。我试过了 trasnlate功能,但不起作用。我不知道在哪里以及如何使用下面代码中的函数,请对此提供帮助

<xsl:template match="warning">
    <xsl:param name="drugsSub" select="'false'"/>
    <tr>
      <td class="dataRowBorderBottom rowColor" style="width: 35%; padding-right: 5px; font-size:.85em;">
        **<xsl:apply-templates select="translate(warningId,'/','/ ')">**    This is not working. I want translate function to work both warningId. A value comes for this variable from some other file.
          <xsl:with-param name="drugsSub" select="$drugsSub"/>
        </xsl:apply-templates>
      </td>
      <td class="dataRowBorderBottom rowColor leftPadding" style="width: auto; padding-bottom: 15px; font-size:.85em;">
        <xsl:apply-templates select="severity"/>
      </td>
      <td class="dataRowBorderBottom rowColor leftPadding" style="width: 13%;font-size:.85em;">
        <xsl:apply-templates select="documentationRating"/>
      </td>
      <td class="dataRowBorderBottom rowColor leftPadding" style="width: 35%; padding-top: 3px; font-size:.85em;">
        <xsl:value-of select="warningText"/>
      </td>
    </tr>
  </xsl:template>

****这是行不通的。我希望翻译功能同时工作警告ID。此变量的值来自其他文件。

我可以告诉您代码不起作用的原因:translate()生成一个字符串,您不能将模板应用于字符串(仅应用于节点集)


但我无法告诉您如何修复它,因为我不知道您想要实现什么。

请指定您想要实现的目标。样本输入和输出都可以。很可能
translate()
并没有做您认为它能做的事情。也许您正试图用字符串
/
替换每个
/
字符?如果是这样的话,最佳答案取决于您是否可以使用XSLT 2.0,还是只能使用XSLT 1.0。此问题与以下问题重复: