XML(WSDL) ファイルでメソッドを非表示にするために、次のコードを使用します。
<xsl:template match="wsdl:operation[@name = 'GetCityWeatherByZIP']" />
<xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPSoapIn']" />
<xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPSoapOut']" />
<xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpGetIn']" />
<xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpGetOut']" />
<xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpPostIn']" />
<xsl:template match="wsdl:message[@name = 'GetCityWeatherByZIPHttpPostOut']" />
<xsl:template match="s:element[@name = 'GetCityWeatherByZIP']" />
<xsl:template match="s:element[@name = 'GetCityWeatherByZIPResponse']" />
ここで、複数の if ではなく、すべてを非表示にするための条件のみを使用したいと考えています。実際、私は .xslt ファイルでこのいくつかの行を使用して、特別な IP アドレスからメソッドを隠しています。
<xsl:template match="wsdl:operation[@name = 'GetCityWeatherByZIP']">
<xsl:variable name="rcaTrimmed"
select="substring-before(substring-after($remoteClientAddress, '/'), ':')" />
<xsl:if test="not($rcaTrimmed = '192.168.3.74')">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:if>
</xsl:template>
すべてのコードを 1行に追加し**<xsl:template match**
てから、それらすべてを特別な IP アドレスから隠したいのですが、すべてのメソッドに対してこれらのコードを 1 つずつ書きたくないのです。どうすればこの目的を達成できますか?