XSLT - Checking for a substring
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two XSLT variables as given below: <xsl:variable name="staticBaseUrl" select="'https://www.hello.com/htapi/PrintApp.asmx/getGames?contentId=id_sudoku&uniqueId="123456"&pageformat=a4'" /> <xsl:variable name="dynamicUrl" select="'https://www.hello.com/htapi/PrintApp.asmx/getGames'" /> How to check whether the second string (dynamicUrl) is a substring of the first string (staticBaseUrl) or not? 回答1: To check if one string is contained in another, use the contains function. Example: <xsl:if test="contains($staticBaseUrl,$dynamicUrl)">