-1

INPUT

"hi all i need an xslt to replace < symbol to &lt: in the particular node of an xml, how can i achieve this."

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:adm="http://axn/someurl/">
<soapenv:Header/>
<soapenv:Body>
  <adm:Access>
     <String1> <log item='value' price='fixed'/></String1>
     <String2><US/></String2>
  </adm:Access>
 </soapenv:Body>
</soapenv:Envelope>

OUTPUT

"this is wat finally i need. replcing < with < at node0 and node1.i need to replace only "<" but not ">" symbol"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axn="http://axn/someurl/">
<soapenv:Header/>
<soapenv:Body>
  <axn:Access>
  <node0>&lt;log item='value' price="fixed"  /></node0>
  <node1>&lt;US /></node1>
  </axn:Access>
  </soapenv:Body>
 </soapenv:Envelope>

"have tried to parse the content of node0 and node1 as text with and replace but it dint work"

1 Answers1

0

It is not possible, using XSLT, to replace the < symbol. XSLT provides access to the values inside markup (e.g. element names) and to the markup payload - not to the markup itself (other than by way of copy).

What you can do is output some text using the above values - see for example:
Converting XML to escaped text in XSLT
How do I Emit Escaped XML representation of a Node in my XSLT's HTML Output

Community
  • 1
  • 1
michael.hor257k
  • 113,275
  • 6
  • 33
  • 51