2016-08-08 46 views
0

Das ist mein XSLT-Code zu aktualisieren cdata Segment unter arg1 SegmentXslt Code cdata Segment in meiner Karte

<?xml version="1.0" encoding="UTF-16"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:ws="http://ws.myimm.htp.com/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s0="http://AIS/IL/ES/QueryIndividualReq/JIM/v1.0"> 
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" indent="yes" /> 
    <xsl:template match="/"> 
    <xsl:apply-templates select="/s0:records" /> 
    </xsl:template> 
    <xsl:template match="/s0:records"> 
    <soapenv:Envelope> 
     <soapenv:Header/> 
     <soapenv:Body> 
     <!--Optional:--> 
     <ws:incoming> 
      <arg0>IH035</arg0> 
      <!--Optional:--> 
      <arg1> 
      <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text> 

      <root> 
       <agencyId>AGF</agencyId> 
       <password>password</password> 
       <records> 
       <xsl:copy-of select="item"/> 
       </records> 
      </root> 
      <xsl:text disable-output-escaping="yes"> 
      ]]&gt;</xsl:text> 
      </arg1> 
     </ws:incoming> 
     </soapenv:Body> 
    </soapenv:Envelope> 
    </xsl:template> 
</xsl:stylesheet> 

Eingang, die ich vorbei bin zu diesem XSLT-Code zu aktualisieren ist

Eingang

<?xml version="1.0"?> 
<records xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://AIS/IL/ES/QueryIndividualReq/JIM/v1.0"> 
    <item xmlns=""> 
    <txn_id>1</txn_id> 
    <name>Ali Imran Mutalib</name> 
    <ppt_no>001FILIPINA</ppt_no> 
    <nat_cd>PHL</nat_cd> 
    <dob>19800101</dob> 
    <sex_cd>2</sex_cd> 
    <ppt_exp_dt>22102019</ppt_exp_dt> 
    <roc_no>591104-07-5347</roc_no> 
    </item> 
</records> 

Output Ergebnis ist

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.myimm.htp.com/"> 
    <soapenv:Header /> 
    <soapenv:Body> 
    <ws:incoming> 
     <arg0>IH035</arg0> 
     <arg1><![CDATA[<root><agencyId>AGF</agencyId><password>password</password><records><item xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <txn_id>1</txn_id> 
    <name>Ali Imran Mutalib</name> 
    <ppt_no>001FILIPINA</ppt_no> 
    <nat_cd>PHL</nat_cd> 
    <dob>19800101</dob> 
    <sex_cd>2</sex_cd> 
    <ppt_exp_dt>22102019</ppt_exp_dt> 
    <roc_no>591104-07-5347</roc_no> 
    </item></records></root> 
      ]]></arg1> 
    </ws:incoming> 
    </soapenv:Body> 
</soapenv:Envelope> 

Aber ich brauche die Ausgabe in diesem Format seine

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:ws="http://ws.myimm.htp.com/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ws:incoming> 
     <arg0>IH035</arg0> 
     <arg1> 
     <![CDATA[ 
      <root> 
       <agencyId>AGF</agencyId> 
       <password>password</password> 
       <records> 
        <item> 
         <txn_id>1</txn_id> 
         <name>Ali Imran Mutalib</name> 
         <ppt_no>001FILIPINA</ppt_no> 
         <nat_cd>PHL</nat_cd> 
         <dob>19800101</dob> 
         <sex_cd>2</sex_cd> 
         <ppt_exp_dt>22102019</ppt_exp_dt> 
         <roc_no>591104-07-5347</roc_no> 
        </item> 
       </records> 
      </root> 
      ]]> 
     </arg1> 
     </ws:incoming> 
    </soapenv:Body> 
</soapenv:Envelope> 

Wie kann ich this.Can jemand bitte helfen Sie mir auf diesen

Antwort

0

achive Unter der Annahme, dass Sie nur wollen die Namespace-Deklarationen aus den kopierten item entfernen, ändern :

<xsl:copy-of select="item"/> 

zu:

<xsl:apply-templates select="item"/> 

und fügen Sie die folgende Vorlage hinzu:

<xsl:template match="*"> 
    <xsl:element name="{local-name()}"> 
     <xsl:apply-templates/> 
    </xsl:element> 
</xsl:template> 

Beachten Sie, dass Ihre erste Vorlage redundant ist und entfernt werden kann.

+0

Dank Michael.It erarbeitet. – Chitra

0

Versuchen Sie, diese

<?xml version="1.0" encoding="UTF-16"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:ws="http://ws.myimm.htp.com/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s0="http://AIS/IL/ES/QueryIndividualReq/JIM/v1.0"> 
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" indent="yes" /> 
    <xsl:template match="/s0:records"> 
    <soapenv:Envelope> 
     <soapenv:Header/> 
     <soapenv:Body> 
     <!--Optional:--> 
     <ws:incoming> 
      <arg0>IH035</arg0> 
      <!--Optional:--> 
      <arg1> 
      <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text> 
      <root> 
       <agencyId>AGF</agencyId> 
       <password>password</password>   
       <records> 
       <item> 
       <xsl:apply-templates/> 
      </item> 
       </records>    
      </root> 
      <xsl:text disable-output-escaping="yes"> 
      ]]&gt;</xsl:text> 
      </arg1> 
     </ws:incoming> 
     </soapenv:Body> 
    </soapenv:Envelope> 
    </xsl:template> 
    <xsl:template match="/s0:records/item/*"> 
    <xsl:element name="{name()}"> 
      <xsl:apply-templates/> 
     </xsl:element> 
    </xsl:template> 
</xsl:stylesheet>