导入XML信息Excel时缺少元素
我得到了以下XML文件:导入XML信息Excel时缺少元素,xml,excel,Xml,Excel,我得到了以下XML文件: <toc label="My information" href="index.html"> <topic label="Main page 1" href="topics/one.html"> <topic label="1a" href="topics/1a.html"/> <topic label="1b" href="topics/1b.html"/> </topic> &l
<toc label="My information" href="index.html">
<topic label="Main page 1" href="topics/one.html">
<topic label="1a" href="topics/1a.html"/>
<topic label="1b" href="topics/1b.html"/>
</topic>
<topic label="Main page 2" href="topics/two.html">
<topic label="2a" href="topics/2a.html"/>
<topic label="2b" href="topics/2b.html"/>
</topic>
</toc>
当我导入Excel 2016时,我得到以下信息:
这太棒了,除了我希望“主页1”和“主页2”各有一行之外。如何让Excel包含这些行?我通过XSL运行XML来解决这个问题,XSL复制了所有具有子节点的节点:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="toc">
<topic label="{@label}" href="{@topic}">
<xsl:apply-templates/>
</topic>
</xsl:template>
<xsl:template match="topic">
<topic label="{@label}" href="{@href}">
<!-- if topic has children, insert another copy here -->
<xsl:if test="topic">
<topic label="{@label}" href="{@href}"/>
</xsl:if>
<xsl:apply-templates/>
</topic>
</xsl:template>
</xsl:stylesheet>