【发布时间】:2018-11-18 18:12:20
【问题描述】:
我将属性转换为表格, 但我不知道会设置哪些属性, 所以我得到了以下解决方案:
<simpletable spectitle="Chapter Attribute">
<sthead>
<stentry>Name</stentry>
<stentry>Wert</stentry>
</sthead>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="Head/@*"/>
</simpletable>
<!-- ********************* Chapter Attribute -> simpleTable....strow ************************************************************************************** -->
<xsl:template match="Chapter/@*|Head/@*">
<xsl:choose>
<xsl:when test="string(.)">
<strow>
<stentry>
<xsl:value-of select="local-name(.)"/>
</stentry>
<stentry>
<xsl:value-of select="."/>
</stentry>
</strow>
</xsl:when>
</xsl:choose>
</xsl:template>
这是我要处理的 XML:
<Chapter title="Information" termpool="" nodeid="DE-123" xmltag="Chapter"
status="" id="" language="" version="">
<Head UniqueID="DE-234" xmlns:axf="http://www.antennahouse.com/names
/XSL/Extensions">Information</Head>
这是结果
<strow>
<stentry>title</stentry>
<stentry>Information</stentry>
</strow>
<strow>
<stentry>nodeid</stentry>
<stentry>DE-123</stentry>
</strow>
<strow>
<stentry>xmltag</stentry>
<stentry>Chapter</stentry>
</strow>
<strow>
<stentry>UniqueID</stentry>
<stentry>DE-234</stentry>
</strow>
对于 > 它工作正常,但对于 > 它不识别 xmlns:axf (或者 xmlns:axf 有一个值集)
希望有人给我一个提示,如何使用 @* 访问 xmlns:axf 谢谢乔辰
【问题讨论】:
标签: loops xslt namespaces attributes