I am trying to convert the following URI parameters and respective values, using substring function. but it is giving error, obvious because it is not a string.
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=123
Input is from a variable.
XSLT:
<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>
Error from xmlSpy is:
XML Production Error: Character ''' within text ''' does not fulfill production 'Name'.