sách gpt4 ai đã đi

基于配置文件的 XSLT 转换

In lại 作者:行者123 更新时间:2023-12-04 05:03:52 31 4
mua khóa gpt4 Nike

输入:



This is sample 1
This is sample 2



Đầu ra:

~COLOR~[Green]This is sample 1~COLOR~[Red]This is sample 2

配置文件:


#3e9a3cGreen1
#009bd2Red2


XSLT 尝试过:














~COLOR~[Green]
~COLOR~[Red]






我需要根据配置文件将上面给出的输入转换为所需的输出。如果用户更新了配置文件,并且如果 Input 具有 mathcolor 属性值,则其对应的颜色应转换为如 output 所示。我可以使用 XSLT 1.0。请帮助解决这个问题

Ví dụ:
如果用户在配置文件中添加如下代码: #007c62Magenta3并且输入包含 mathcolor="#007c62",那么 Magenta 应该应用在输出中。

1 Câu trả lời

这应该有效:
样式表




xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:mml="http://www.w3.org/1998/Math/MathML"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.w3.org/1998/Math/MathML">















~COLOR~[

<>
select="document($config.file)/colors/color
[mathcolor = current()/@mathcolor]/textcolor"/>
]




输入


This is sample 1
This is sample 2


配置文件



#3e9a3c
Green
1


#009bd2
Red
2


Đầu ra


~COLOR~[Green]This is sample 1~COLOR~[Red]This is sample 2

关于基于配置文件的 XSLT 转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15760051/

31 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com