2012-08-06 11 views
1

동적으로 루트 요소를 작성하면 지금은 매개 변수의 예에서이 URL NODE 값이 나는 XSLT 서비스에이 노드 값을 통과 한XSLT는 : 다음과 같은 매개 변수

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

XML 데이터의 노드입니다

<xsl:param name="UserName"/> 
<xsl:param name="Password"/> 
<xsl:param name="WebServiceUrl"/> 
봉투 태그와 그래서

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

FINA에서이 값을 사용

지금은 soapenv을 만들려면 내가이 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 코드를 주어진 XML에 적용하면 나는 다음과 같은 OUTPUT을 얻습니다. 올바르지 않습니다.

<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> 

내 원하는 출력은 Folllowing과 같습니다

<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> 
+0

[Xslt : 동적으로 시작 요소 만들기 (시작 태그)] 가능한 복제본 (http://stackoverflow.com/questions/11808073/xslt-create-root-element-starting-tag-dynamically) –

+0

@DimitreNovatchev 도움말 – user1578018

+0

Nida, 귀하의 동일한 질문 http://stackoverflow.com/questions/11808073/xslt-create-root-element-starting-tag-dynamically 완전하게 답변 - 더 많은 "도움"이 필요합니까? 제발, 한 번 이상 같은 질문을하지 마십시오. –

답변

0

NIDA는, AFAIK, XMLSPY 어떤 xxx:node-set() 확장이 없습니다.

을 시도해보십시오

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

혹은이 과정이 여전히 오류에 이르게되면, MSXML 또는 색슨 네임 스페이스와 xxx:node-set() 기능을 사용해보십시오.

관련 문제