xslt - remove child node namespace and copy another node into a variable -


I am trying to copy all the children of soap elements: the header element in one variable and the pricing vacancy is empty Also trying to remove the name space (Xmlns = "http://www.ama.net") and the output of XML is only the pricing irrigator part I am able to remove the PricingRequest blank space and get the appropriate output, but soap Not able to store: header child element Not in a variable, is it possible to copy the basic elements of soap: Herr in a variable?

INPUT XML:

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Soaps: Envelope xmlns: Soap = "http://schemas.xmlsoap.org/soaf/envelope/" & gt; & Lt; Soap: header xmlns = "http://www.ama.net/1axml-msg/schema/msg-header-1_0.xsd" & gt; & Lt; MessageHeader ResponseRequested = "true" version = "1.0" terminnect = "true" reverse = "true" id = "09B5581A" soap: samsa = "1" & gt; & Lt; To & gt; 1ASI & lt; /> & Lt; To & gt; 1ASRINSAIG & lt; To / & gt; & Lt; Timestamp & gt; & Lt; GenerationTime & gt; 2014-10-22T12: 41: 38Z & lt; / GenerationTime & gt; & Lt; / Timestamp & gt; & Lt; / MessageHeader & gt; & Lt; / Soap: Header & gt; & Lt; Soaps: Body & gt; & Lt; PricingRequest xmlns = "http://www.ama.net" & gt; & Lt; OriginatorSection & gt; & Lt; DeliverySystem & gt; & Lt; CompanyId> 1 a & lt; / CompanyId> & Lt; CityCode & gt; MUC & lt; / CityCode & gt; & Lt; / DeliverySystem & gt; & Lt; / OrigatorSection & gt; & Lt; / PricingRequest & gt; & Lt; / Soap: body & gt; & Lt; / Soap: Envelope & gt;  

XSLT:

  & lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/xsl/transform" xmlns: x = "http://www.ama.net" xmlns: soap = "http : //schemas.xmlsoap.org/soap/envelope/ "& gt; & Lt; Xsl: output method = "xml" omit-xml- declaration = "yes" indent = "yes" /> & Lt; Xsl: strip-space element = "*" /> & Lt ;! - & lt; Xsl: template match = "/ * [local-name () = 'envelope']" & gt; & Lt; Xsl: variable name = "SOAPHeader" = "/ soap: header / node ()" /> & Lt; XSL: Text & gt; Message header information: & lt; Xsl: Select Copy-Select = "$ SOAPHeader" /> & Lt; / XSL: text & gt; & Lt; / XSL: Templates & gt; - & gt; & Lt; Xsl: template match = "*" & gt; & Lt; Xsl: element name = "{name ()}" & gt; & Lt; Xsl: copy-of select = "@ *" / & gt; & Lt; XSL: implemented-templates / & gt; & Lt; / XSL: element & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "* [no (ancestor-or-self :: X: pricing sequence)]" & gt; & Lt; XSL: implemented-templates / & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;  

The output is expected, but is not capable of copying soap: Header in a variable:

   1 a & lt; / CompanyId> & Lt; CityCode & gt; MUC & lt; / CityCode & gt; & Lt; / DeliverySystem & gt; & Lt; / OrigatorSection & gt; & Lt; / PricingRequest & gt; Try  

;

  & lt; Xsl: template match = "/" & gt; & Lt; Xsl: variable name = "SOAPHeader" = "/ soap: envelope / soap: header / node ()" /> & Lt; Xsl: text & gt; Message header INFO: & lt; / Xsl: text & gt; & Lt; Xsl: copy-of select = "$ SOAPHeader" /> & Lt; / XSL: Templates & gt;  

Note :

  1. & lt; Xsl: text & gt; can not contain hair elements;
  2. Your version has conflicting templates for SOAP: envelope .

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -