Handling special characters in XSLT transformation

Hi,

The input XMl for transformSerialXML has some special characters such as ‘&’ and the XSLT transformation is throwing an error due to this. If I try encoding before stringtobytes then too its facing a problem.

how the special characters can be handled.

Current flow.

stringtobytes
transformSerialXML (output in bytes)
bytestostring

Thanks,
Bharathi

XML with characters such as &, <, > and others is not valid XML. Such characters need to be converted to “character entities” when the XML is created. For example, if & appears within a data element it must be represented as &. The process that is creating the XML needs to do this. If IS is being used the simplest way is to set the encode input parameter to true in the call to pub.xml:documentToXMLString.

Try replacing special characters in XML string before tranforming using these encoding.

& -> &
‘ -> '
“ -> "
< -> <

-> >

Thanks,
Siva

setting encode input parameter to true in the call to pub.xml:documentToXMLString is the right approach to go and then call your existing flow stringtobytes etc…

HTH,
RMG

The reason I recommended to replace with encoding strings was, I did experienced similar issue with IS 6.1

My step after receiving XML document is to convert to String using pub.xml:documentToXMLString and set encoded to ‘true’. But, ‘&’ character still contained in xml string data causing transformation error. So, manually replaced special characters using mentioned procedure.

Hope this answers.

-Siva

Setting encode in documenttoXMLString solved the problem.

Thanks
Bharathi

Hi,

Did anybody have a problem with British pound (£) ?

The encoding in documentToXMLString didn’t work with this symbol.

Thanks,

Rodrigo

Even I am also having the same problem with Registered trademark ®, copyright symbols ©.

May I know how to handle this.

Thanks.

For these kind use the string:replace service function and handle it…not possible with HTML encoding etc…and tags.

HTH,
RMG

Thanks rmg. :slight_smile: