我试图从calimero中修改ets4_import,以匹配旧的ETS4项目和新的项目。
能修改一下吗
<xsl:template match="/" xmlns:b="http://knx.org/xml/project/11">到某种程度上
<xsl:template match="/" xmlns:b="http://knx.org/xml/project/11 or http://knx.org/xml/project/10">XML文件要么以
<?xml version="1.0" encoding="utf-8"?>
<KNX xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" CreatedBy="ETS4" ToolVersion="ETS 4.0.3 (Build 3250)" xmlns="http://knx.org/xml/project/11">或
<?xml version="1.0"?>
<KNX xmlns="http://knx.org/xml/project/10" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" CreatedBy="ETS4" ToolVersion="4.0.1387.12605">这里是完整的XSL文件。
有人能帮我吗?
谢谢
更新
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b10="http://knx.org/xml/project/10" xmlns:b="http://knx.org/xml/project/11" >
<xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="b:KNX/b:Project/b:Installations/b:Installation/b:Topology">
<datapoints>
<xsl:for-each select="b:Area/b:Line/b:DeviceInstance/b:ComObjectInstanceRefs/b:ComObjectInstanceRef">
<xsl:sort select="b:Connectors/b:Send/@GroupAddressRefId"/>
<xsl:if test="not(preceding::b:Connectors/b:Send/@GroupAddressRefId = current()/b:Connectors/b:Send/@GroupAddressRefId)">
<xsl:for-each select="b:Connectors">
<xsl:variable name="verz" select="document(concat(substring(../@RefId,0,7),'/',substring-before(../@RefId, '_O'), '.xml'))/b:KNX/b:ManufacturerData/b:Manufacturer/b:ApplicationPrograms/b:ApplicationProgram/b:Static/b:ComObjectTable/b:ComObject[@Id = ../../b:ComObjectRefs/b:ComObjectRef[@Id = current()/../@RefId]/@RefId]" />
<xsl:variable name="grosse"> 是否有可能定义
b: = b: | b10:这样我就不用修改完整的文件了
发布于 2013-04-12 20:20:11
我想你要找的是:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b10="http://knx.org/xml/project/10" xmlns:b11="http://knx.org/xml/project/11">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="b10:MyElement|b11:Element">
<!-- Template code... -->
</xsl:template>
</xsl:stylesheet>尽管您正在匹配根元素,并且一次只转换一个XML文档,但我不太明白这个问题,因为/无论如何都会匹配根元素。
发布于 2013-04-12 16:15:46
使用XSLT2.0,您可以首先更改(甚至可能删除)文档的命名空间,然后应用您拥有的巨大模板。在XSLT1.0中,可以将所有出现的b:XYZ替换为*[local-name()='XYZ']。
https://stackoverflow.com/questions/15975000
复制相似问题