1
我試圖刪除節點名稱,但保留內容或將節點的內容複製到其父節點。我從SSRS導出XML,並將XSLT文件附加到報表RDL。我覺得我很喜歡我的xslt。我試圖刪除文件中頻繁重複的節點「Cell」。XSLT刪除節點但保留內容
我想這一點:
<ReportSectionAPercentLabel>
<Cell>
<losPct>0.262158054711246</losPct>
</Cell>
</ReportSectionAPercentLabel>
看起來像這樣:
<ReportSectionAPercentLabel>
<losPct>0.262158054711246</losPct>
</ReportSectionAPercentLabel>
這是XML的excert:
<?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。我有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>
謝謝你的sooo多的解釋。 A)我不瞭解名稱空間,B)我現在知道,不是使用標準模板作爲SSRS輸出,而是需要爲每個名稱空間指定名稱空間。謝謝! – BClaydon