I want to route to specific endpoints if the incoming URI matches otherwise reject. I want to route to both of the above endpoints if the incoming URI matches with "/Location" or /Main.How should I write OR condition here ?
Here is my xslt which I tried:
Error: The below stylesheet is giving invalid URI error.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:dp="http://www.datapower.com/extensions" xmlns:regexp="http://exslt.org/regular-expressions"
extension-element-prefixes="dp regexp"
exclude-result-prefixes="dp regexp">
<xsl:template match="/">
<xsl:variable name="uri_in" select="dp:variable('var://service/URI')"/>
<xsl:variable name="serviceMapFileName" select="concat('local:///GATEWAY/Config/','service_map.xml')"/>
<xsl:variable name="serviceMapTable" select="document($serviceMapFileName)" />
<dp:set-local-variable name="'var://local/valid_uri'" value="'N'" />
<xsl:for-each select="$serviceMapTable/servicelist/service">
<xsl:choose>
<!-- Test if we have a match in the incoming URI and the service data map table. -->
<xsl:when test="contains($uri_in, @Location)">
<xsl:message dp:priority="debug">
<xsl:value-of select="concat('name:', @name, ' id:', @Location, ' uri:', $uri_in)"/>
</xsl:message>
<dp:set-variable name="'var://service/routing-url'" value="concat('http://10.14.147.112:', @port,$uri_in)" />
<dp:set-variable name="'var://context/LoggingContext/service_name'" value="@name"/>
<dp:set-local-variable name="'var://local/valid_uri'" value="'Y'" />
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:for-each>
<xsl:if test="not(string(dp:local-variable('var://local/valid_uri')) = 'Y')">
<dp:reject>Not a valid incoming uri to XI50 !!!</dp:reject>
</xsl:if>
</xsl:template>
</xsl:stylesheet
My service_map.xml file in the backend :
<servicelist>
<service name="MPG_Retailer"
id="/Location"
port="4188"/>
<service name="MPG_Partner"
id="/Main"
port="9988"/>
</servicelist>