1

XMLデータのノードは次のとおりです

<ProcessData
 <WebServiceUrl>"http://webser.part.site"</WebServiceUrl>
<UserName>nida</UserName>
<Passsword>123</Password>
</ProcessData>

このノード値をXsltServiceに渡しました。これで、パラメーターにこのurlNODE値が含まれます。

<xsl:param name="UserName"/>
<xsl:param name="Password"/>
<xsl:param name="WebServiceUrl"/>

次に、soapenv:Envelopeタグを作成し、この値を使用します

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="$WebServiceUrl">

したがって、XSLTコードから必要な最終的な出力は次のようになります。

enter code here
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"          xmlns:web="http://webservice2.partner.insite">
 <soapenv:Header/>
<soapenv:Body>
<web:upload>
<web:username>nida</web:username>
<web:password>123</web:password>
</web:upload></soapenv:Body></soapenv:Envelope>

このXSLTを適用すると

この変換

<xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:ext="http://exslt.org/common"
     xmlns:soapenv="http:/`enter code here`/schemas.xmlsoap.org/soap/envelope/"
     exclude-result-prefixes="ext soapenv">
        <xsl:output omit-xml-declaration="yes" indent="yes"/>
      <xsl:param name="pUserName" select="'nida'"/>
      <xsl:param name="pPassword" select="'123'"/>
      <xsl:param name="pWebServiceUrl" select="'http://webser.part.site'"/>

        <xsl:variable name="vrtfDummy">
         <xsl:element name="web:dummy" namespace="{$pWebServiceUrl}"/>
        </xsl:variable>

        <xsl:variable name="vNS" select="ext:node-set($vrtfDummy)/*/namespace::web"/>

     <xsl:template match="/*">
       <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
           <xsl:copy-of select="$vNS"/>
         <soapenv:Body>
           <xsl:element name="web:upload" namespace="{$vNS}">
             <xsl:element name="web:username" namespace="{$vNS}">
               <xsl:value-of select="$pUserName"/>
             </xsl:element>
             <xsl:element name="web:password" namespace="{$vNS}">
               <xsl:value-of select="$pPassword"/>
             </xsl:element>
           </xsl:element>
         </soapenv:Body>
         </soapenv:Envelope>
     </xsl:template>
</xsl:stylesheet>

は数日から解決策を探しているので、私は本当に困っています。私はXSLTを初めて使用するので、XSLTについてはよくわかりません。必要な出力を達成するのを手伝ってください。

上記のXSLTコードを指定されたXMLに適用すると、次の出力が表示されますが、これは正しくありません。

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Body>
    <web:upload xmlns:web="http://webser.part.site">
   <web:username>nida</web:username>
    <web:password>123</web:password>
   </web:upload>
       </soapenv:Body>
    </soapenv:Envelope>

私の希望する出力は次のとおりです。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"          xmlns:web="http://webservice2.partner.insite">
 <soapenv:Header/>
<soapenv:Body>
<web:upload>
<web:username>nida</web:username>
<web:password>123</web:password>
 </web:upload></soapenv:Body></soapenv:Envelope>
4

1 に答える 1

0

Nida、AFAIK、XMLSPYには拡張子がありませんxxx:node-set()

試してください

<xsl:variable name="vNS" select="$vrtfDummy/*/namespace::web"/> 

または、それでもエラーが発生する場合は、MSXML または Saxon の名前空間とxxx:node-set()関数を使用してみてください。

于 2012-08-06T04:17:10.820 に答える