javaxsltxquerysoaosb

How to convert &lt;br&gt; to <br> in xslt/xquery


I am getting this request

<description>V1&lt;br&gt;V2&lt;br&gt;V3</description>

and I need to convert it into below code and send it to target system:

V1<br>V2<br>V3

How I can convert it in xslt/query?


Solution

  • You don't actually need to do any conversion. The string value of the <description> element is the string V1<br>V2<br>V3. Your only problem is to avoid it being converted to something else, which will happen for example if you try to output it using the XML serialization method.

    So it depends a bit on what you mean by "send it to the target system".

    With XSLT, typically you would want to output the result using the text output method.

    With XQuery, a query that returns a string to the calling application will do the right thing.