【发布时间】:2011-03-09 22:47:04
【问题描述】:
我正在处理从 ArgoUML 导出的 XMI 文档。它具有表单元素
<UML:DataType href='http://argouml.org/profiles/uml14/default-uml14.xmi#-84-17--56-5-43645a83:11466542d86:-8000:000000000000087C'/>
指向表单的一个项目
<UML:DataType xmi.id="-84-17--56-5-43645a83:11466542d86:-8000:000000000000087C"
name="Integer"
isSpecification="false"
isRoot="false"
isLeaf="false"
isAbstract="false"/>
我已经在 xslt 文件的顶部声明了 xmlns:UML="org.omg.xmi.namespace.UML"。我想我应该使用类似的东西:
<xsl:variable name="typeref" select="@href"/>
<xsl:variable name="ns" select='substring-before($typeref, "#")'/>
<xsl:variable name="identifier" select='substring-after($typeref, "#")'/>
<xsl:value-of xmlns:UML="$ns"
select='//UML:DataType[@xmi.id="$identifier"]/@name'/>
推断我的 UML 属性类型是整数,但这给了我
SystemId Unknown; Line #136; Column #94; A location step was expected following the '/' or '//' token.
如果我将 xmlns 更改为 AAA,那么我不会收到任何错误,而是一个空标签。我在 Debian 挤压上使用 Xalan2。我错过了什么?
【问题讨论】:
-
我没有看到语法错误。但看起来您正在尝试使用
xmlns:UML="$ns"进行动态命名空间声明。为什么?除了这是不可能的,我认为对你的情况没有用。 -
我同意前面的回答,对于 xmlns:UML="$ns" 的(无效)命名空间前缀规范的提议目的是什么?
标签: xslt xml-namespaces xalan