0

I have following code:

XslCompiledTransform transform = new XslCompiledTransform();
XsltArgumentList arguments = new XsltArgumentList();

string txId = SPOZUS_T2S_COMMON.Spozus.GetUniqueInputId;
arguments.AddParam("Id", string.Empty, txId);

foreach (KeyValuePair<string, string> kvp in args)
{
    arguments.AddParam(kvp.Key, string.Empty, kvp.Value);
}
using (StringReader sr = new StringReader(xslt))
{
    using (XmlReader reader = XmlReader.Create(sr))
    {
            transform.Load(reader); // load transformation
    }
}

XDocument inDoc = new XDocument(_ecpIn.Message); // input document
XDocument outDoc = new XDocument(); // output document

using (XmlReader reader = inDoc.CreateReader())
{
    XmlWriter XWriter = outDoc.CreateWriter();
    using (XmlWriter writer = XmlWriter.Create(XWriter, transform.OutputSettings))
    {
        transform.Transform(reader, arguments, writer); // do the transformation
    }
}

I have the source document inDoc in utf-8 and I need to replace accentuated chars in the values of text value elements and get rid of those that does not match this pattern ([0-9a-zA-Z-\?:().,'+ ]([0-9a-zA-Z-\?:().,'+ ](/[0-9a-zA-Z-\?:().,'+ ])?)). Any idea?

7
  • So you are just going to remove characters from the document? It seems like this would change the meaning of the data. Commented Feb 26, 2014 at 15:16
  • No I would like to replace accentuated characters with their unaccented versions and replace all other characters not defined in the pattern with space. Commented Feb 27, 2014 at 7:43
  • This will change the meaning of the data. You should work to make the recipient of the data handle utf-8. Commented Feb 27, 2014 at 14:23
  • You can try to persuade SWIFT and Eurosystem to throw away their backward system compatibility policy. :-) There is no possibility to change this requirement. Commented Feb 28, 2014 at 9:04
  • Do SWIFT and Eurosystem support windows-1252 or a different extended ascii character set? Commented Mar 1, 2014 at 0:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.