我有一个这样的xml(FUSE蓝图定义文件):
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:jaxws="http://cxf.apache.org/blueprint/jaxws"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://cxf.apache.org/blueprint/jaxws
http://cxf.apache.org/schemas/blueprint/jaxws.xsd
http://camel.apache.org/schema/blueprint/cxf
http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
...
<bean class="xxxxx.fuse.util.CommonAuthInterceptor" id="authorizationInterceptor">
<property name="methodRolesMap">
<map>
<entry key="xxxElemE1" value="xxxElemE1Role"/>
<entry key="xxxTipusE1" value="xxxTipusE1Role"/>
<entry key="xxxLekerdezE1" value="xxxLekerdezE1Role"/>
<entry key="xxxValtozasE1" value="xxxValtozasE1Role"/>
</map>
</property>
<property name="globalRoles" value="xxxUsers"/>
</bean>
...
<camelContext id="xxxContext" xmlns="http://camel.apache.org/schema/blueprint">
<route id="xxxModositE1_Route" streamCache="true">
<from id="xxxModositE1_from1" uri="cxf:bean:xxxModositE1_LocalEndpoint?dataFormat=PAYLOAD"/>
<convertBodyTo id="xxxModositE1_convertBodyTo1" type="java.lang.String"/>
<wireTap id="xxxModositE1_wireTap1" uri="direct-vm:logRequest"/>
<to id="xxxModositE1_to2" uri="cxf:bean:xxxModositE1_RemoteEndpoint?dataFormat=PAYLOAD"/>
<convertBodyTo id="xxxModositE1_convertBodyTo3" type="java.lang.String"/>
<wireTap id="xxxModositE1_wireTap3" uri="direct-vm:logResponse"/>
</route>
...
</camelContext>
</blueprint>
我必须在最后一个条目和最后一个路径后添加新元素。问题是xslt在新添加的路由元素中生成额外的命名空间定义,但不在条目中生成。这是我xslt的相关部分:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
exclude-result-prefixes="xsd">
<xsl:param name="service-name"/>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
...
<xsl:template match="*:map/*:entry[last()]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
<entry key="{$service-name}" value="{$service-name}Role"/>
</xsl:template>
...
<xsl:template match="*:camelContext/*:route[last()]">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
<route id="{$service-name}_xslt_Route" streamCache="true">
<from id="{$service-name}_from1" uri="cxf:bean:{$service-name}_LocalEndpoint?dataFormat=PAYLOAD"/>
<convertBodyTo id="{$service-name}_convertBodyTo1" type="java.lang.String"/>
<wireTap id="{$service-name}_wireTap1" uri="direct-vm:logRequest"/>
<to id="{$service-name}_to2" uri="cxf:bean:{$service-name}_RemoteEndpoint?dataFormat=PAYLOAD"/>
<convertBodyTo id="{$service-name}_convertBodyTo3" type="java.lang.String"/>
<wireTap id="{$service-name}_wireTap3" uri="direct-vm:logResponse"/>
</route>
</xsl:template>
<xsl:stylesheet>
条目的输出是正确的,其中没有额外的命名空间,但路由包含:
<route xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
id="xxxKeresE1_xslt_Route"
streamCache="true">
如何在路由中消除额外的命名空间定义? 谢谢, ZAMEK
答案 0 :(得分:2)
如果您希望sess.run(rotated_image)
元素位于不同的命名空间中,则需要在创建元素的位置使用该命名空间,即更改
route
到
<route id="{$service-name}_xslt_Route" streamCache="true">
<from id="{$service-name}_from1" uri="cxf:bean:{$service-name}_LocalEndpoint?dataFormat=PAYLOAD"/>
<convertBodyTo id="{$service-name}_convertBodyTo1" type="java.lang.String"/>
<wireTap id="{$service-name}_wireTap1" uri="direct-vm:logRequest"/>
<to id="{$service-name}_to2" uri="cxf:bean:{$service-name}_RemoteEndpoint?dataFormat=PAYLOAD"/>
<convertBodyTo id="{$service-name}_convertBodyTo3" type="java.lang.String"/>
<wireTap id="{$service-name}_wireTap3" uri="direct-vm:logResponse"/>
</route>