0

任何人都可以帮助解决这个问题,我正在尝试使用 xslt3.0 函数(xml-to-json)将我的 xml 转换为 json,它不接受我的 xml 格式,现在我正在尝试将我的 XML 转换为另一种格式的 XML使用 xslt 3.0 包含标签名称作为属性和值作为值和标签名称作为数据类型。

输入xml:

<widget>
    <debug>on</debug>
    <window title="Sample Konfabulator Widget">
        <name>main_window</name>
        <width>500</width>
        <height>500</height>
    </window>
    <image src="Images/Sun.png" name="sun1">
        <hOffset>250</hOffset>
        <vOffset>250</vOffset>
        <alignment>center</alignment>
    </image>
    <text data="Click Here" size="36" style="bold">
        <name>text1</name>
        <hOffset>250</hOffset>
        <vOffset>100</vOffset>
        <alignment>center</alignment>
        <onMouseUp>
    sun1.opacity = (sun1.opacity / 100) * 90;
        </onMouseUp>
    </text>
</widget>

输出xml:

<?xml version="1.0" encoding="UTF-8"?>
<map xmlns="http://www.w3.org/2005/xpath-functions">
    <map key="Order">
        <map key="InvestmentAccount">
            <string key="AccountNumber">10</string>
        </map>
        <map key="Parcel">
            <string key="Limit">0</string>
            <string key="ExpiryDate">1900-01-01T00:00:00</string>
            <array key="Asset">
                <map>
                    <string key="Open">25.15</string>
                    <string key="High">25.15</string>
                    <string key="Low">25.11</string>
                    <string key="Close">25.87</string>
                </map>
                <map>
                    <string key="Open">25.15</string>
                    <string key="High">25.15</string>
                    <string key="Low">25.11</string>
                    <string key="Close">25.87</string>
                </map>
            </array>
        </map>
        <string key="OrderDate">2012-10-11T21:46:03.6489906+11:00</string>
    </map>
</map>
4

0 回答 0