Encrypting and instigating XML data using XSL

xiaoxiao2021-03-06  74

XML data A most common problem is that the data is case, and it is often produced in a headache when data conversion is performed. Below is a solution.

Suppose you have some data to be sent to another system, which also identifies the data of the XML format, and requires all uppercase, the example data is as follows:

Example 1: Person.xml

code:

NET_LOVER xianhui meng Mengxian

Suppose you want to convert into the following format:

Example 2: NewPerson.xml

code:

NET_LOVER xianhui meng Mengxian

Solving this conversion problem is generally translate () in the XPath function (), for example:

The result of conversion is as follows:

this is a test

But how do you convert all the text into uppercase? Below is the code for this processing:

Define two variables first:

AbcdefghijklmnopqrStuvwxyz

AbcdefghijklmnopqrStuvwxyz

Conversion again:

The results are as follows:

this is a test

For the questions just now, you can write the XSL files as follows:

Example 3: Person.xsl

AbcdefghijklmnopqrStuvwxyz

AbcdefghijklmnopqrStuvwxyz

"/>

Inspire

What will you think of from above? Encrypt data! Yes, use this method to encrypt the XML data.

example:

code:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 K1aWXJBb2cRdeAMfQgL8yhij976klEFzmYSnIo4DpTZq5rNsUtC0uOPvVwGxH3

The result after encryption is as follows:

8snr6nr6k6nzrn

Decryption is also very simple, just reverse the two variables.

code:

转载请注明原文地址:https://www.9cbs.com/read-90952.html

New Post(0)