我将字符串收集到 xpath
<property xmlns:t="https://services" name="xPathElemet" expression="fn:concat(//t:SNILS/, $func:element)"/>
我想运行这个 xpath 并写一个 Property 的值
<property name="KEY" expression="get-property('xPathElemet')"/>
但只接收收集到的字符串
如何 xpath 的属性?
示例代码序列:
<iterate continueParent="true" expression="//t:Employee">
    <target>
        <sequence>
            <call-template target="save_element">
                <with-param name="key_element" value="Name"/>
            </call-template>
        </sequence>
    </target>
</iterate>
示例代码模板:
<template xmlns="http://ws.apache.org/ns/synapse" name="save_element">
    <parameter name="key_element"/>  <!--example: "Name"-->
    <sequence>
        <property name="KEY" expression="fn:concat(//t:Employee/t:SNILS, ':' ,$func:key_element)" scope="default"
                  type="STRING"/>             <!--example: "111-111-111-1:Name"-->
        <property name="xPathElemet" expression="fn:concat('//t:Employee/t:', $func:element)"/>      <!--example: "//t:Employee/t:Name"-->
        <property name="VALUE" expression="get-property('xPathElemet')" scope="default" type="STRING"/>      <!--example: Den (Now it does not work)-->
        <dbreport>
            <connection>
                <pool>
                    <seetings/>
                </pool>
            </connection>
            <statement>
                <sql>
                    <![CDATA[insert into cache( key , value ) values (?, ?);]]></sql>      <!--insert new line where key = "111-111-111-1:Name" and value = "Den"-->
                <parameter expression="get-property('KEY')" type="VARCHAR"/>
                <parameter expression="get-property('VALUE')" type="VARCHAR"/>
            </statement>
        </dbreport>
    </sequence>
</template>
示例 xml:
<Employees xmlns="https://services">
    <Employee>
        <SNILS>111-111-111-1</SNILS>
        <Name>Den</Name>
    </Employee>
    <Employee>
        <SNILS>111-111-111-2</SNILS>
        <Name>Elena</Name>
    </Employee>
</Employees>