Encrypting and instigating XML data using XSL

zhaozj2021-02-11  175

Encrypting and instigating XML data using XSL

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

NET_LOVER xianhui meng Mengxian

Suppose you want to convert into the following format:

Example 2: NewPerson.xml

NET_LOVER xianhui meng Mengxian

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

The results are 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 < XSL: Value-of select = "Translate (/ Person / Name / First, $ Lowercase, $ Uppercase)" /> inspiration

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

Examples: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 K1aWXJBb2cRdeAMfQgL8yhij976klEFzmYSnIo4DpTZq5rNsUtC0uOPvVwGxH3

The result after encryption is as follows:

8snr6nr6k6nzrn

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

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

New Post(0)