在骆驼上下文xml中添加xsl参数作为标头

时间:2019-06-18 09:36:52

标签: apache-camel

我正在尝试从xml中获取一些随机值,然后尝试在xslt中使用这些值

我已将参数添加到xslt

<xsl:param name="myParam" select="'data/SharedVariable/SetCrmtOrder.xml'"/> 

接下来在骆驼上下文xml中添加

 <setHeader headerName="myParam"><constant>"data/SharedVariable/SetCrmtOrder.xml"</constant></setHeader>

xml -------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<SetCrmtOrderKeyValues
    xmlns:tns="http://www.example.org/KValue_SetCrmtOrder"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.example.org/KeyValue_SetCrmtOrder ../Schemas/KeyValue_SetCrmtOrder.xsd">
    <value1 key="New" value="NEW" />
    <value2 key="Deleted" value="DEL" />
    <value3 key="Modified" value="MOD" />
    <value4key="Existing" value="EXS" />
</SetCrmtOrderKeyValues>

我可以在xpath中使用xml的值,如下所示

xslt ---------------------------------------------- --------------------------

<xsl:when
                                            test="$myParam/SetCrmtOrderKeyValues/value 1[@key = $var2]/@value">  <!-- if incoming fields matches the shared variable -->
                                            <xsl:value-of
                                                select="Auftragspositionsstatus/@value" /> <!-- select the value of shared variable -->
                                        </xsl:when>```

0 个答案:

没有答案