我试图删除节点名称但保留内容,或将节点内容复制到其父节点。我从SSRS导出XML并将XSLT文件附加到报告RDL。我觉得我的xslt已经非常接近了。我试图删除在文件中频繁重复的“Cell”节点。
我想要这个:
<ReportSectionAPercentLabel>
<Cell>
<losPct>0.262158054711246</losPct>
</Cell>
</ReportSectionAPercentLabel>
要呈现如下效果:
<ReportSectionAPercentLabel>
<losPct>0.262158054711246</losPct>
</ReportSectionAPercentLabel>
这是XML中的一部分内容:
这是一个XML片段:
<?xml version="1.0" encoding="UTF8"?>
<Report xmlns="My_Report" Name="My report">
<ReportSectionATablix>
<ReportSectionARowGroup_Collection>
<ReportSectionARowGroup>
<losProvider>Your Enterprise</losProvider>
<ReportSectionAColumnGroup_Collection>
<ReportSectionAColumnGroup>
<ReportSectionAGroupLabel>07</ReportSectionAGroupLabel>
<ReportSectionACountLabel>
<Cell>
<ReportSectionACount>345</ReportSectionACount>
</Cell>
</ReportSectionACountLabel>
<ReportSectionAPercentLabel>
<Cell>
<losPct>0.262158054711246</losPct>
</Cell>
</ReportSectionAPercentLabel>
</ReportSectionAColumnGroup>
<ReportSectionAColumnGroup>
<ReportSectionAGroupLabel>814</ReportSectionAGroupLabel>
<ReportSectionACountLabel>
<Cell>
<ReportSectionACount>153</ReportSectionACount>
</Cell>
</ReportSectionACountLabel>
...
这是XSLT代码。我选错了Cell的Xpath路径吗?
<xsl:template match="node()|@*" >
<xsl:copy>
<xsl:apply-templates select="node()|@*" />
</xsl:copy>
</xsl:template>
<xsl:template match="Cell" >
<xsl:apply-templates select="*" />
</xsl:template>