0
我试图使用子字符串函数转换以下URI参数和相应的值。但它是错误的,因为它不是字符串。
FROM:http://host/URI/api/abc/xml?xxx=a-b-c&pqr=123
TO:http://host/URI/api/abc/xml?yyy=d-e-f&pqr=123XSLT:转换URI参数名称和值
输入是从一个变量。
XSLT:从XMLSPY
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions" xmlns:func="http://exslt.org/functions" xmlns:str="http://exslt.org/strings" xmlns:dpfunc="http://www.datapower.com/extensions/functions" xmlns:dpconfig="http://www.datapower.com/param/config" xmlns:regexp="http://exslt.org/regular-expressions" extension-element-prefixes="dp func dpfunc dpconfig regexp" exclude-result-prefixes="dp func dpfunc dpconfig regexp">
<xsl:template match="/">
<xsl:variable name="currentURI" select="dp:variable('var://service/URI')"/>
<xsl:variable name="new-uri" select="regexp:replace($currentURI, 'xxx', 'yyy')"/>
<xsl:variable name="SubStringBeforeyyy" select="substring-before($new-uri, 'yyy=')"/>
<xsl:variable name="SubStringAfteryyy" select="substring-after($new-uri, '&')"/> <!-- ERROR: -->
<xsl:variable name="NewParmValue" select="'d-e-f'"/>
<xsl:variable name="NewURI" select="concat($SubStringBeforeyyy, $NewParmValue, $SubStringAfteryyy)"/>
</xsl:template>
</xsl:stylesheet>
错误是:
XML Production Error: Character ''' within text ''' does not fulfill production 'Name'.
请出示(
&
)字符我们使用最小但完整的样式表以及导致错误的XML输入。 –请向我们展示您造成您所说错误的XSLT代码。 –