C
CI
I have the following XML file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/
main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships">
<fileVersion appName="xl" lastEdited="4" lowestEdited="4"
rupBuild="4505"/>
<workbookPr defaultThemeVersion="124226"/>
<bookViews>
<workbookView xWindow="120" yWindow="45" windowWidth="18975"
windowHeight="11955" activeTab="2"/>
</bookViews>
<sheets>
<sheet name="chicago" sheetId="1" r:id="rId1"/>
<sheet name="boston" sheetId="2" state="hidden" r:id="rId2"/>
<sheet name="austin" sheetId="3" r:id="rId3"/>
</sheets>
<calcPr calcId="124519"/>
</workbook>
I created a stylesheet to get rid off the 'state' attribute of a
<sheet> elment(s).
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform"
xmlns:y="http://schemas.openxmlformats.org/spreadsheetml/2006/
main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships"
exclude-result-prefixes="y">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="y:sheet">
<sheet name="{@name}" sheetId="{@sheetId}" r:id="{@r:id}">
<xsl:apply-templates/>
</sheet>
</xsl:template>
</xsl:stylesheet>
And here is the result I get:
<?xml version="1.0"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/
main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships">
<fileVersion appName="xl" lastEdited="4" lowestEdited="4"
rupBuild="4505"/>
<workbookPr defaultThemeVersion="124226"/>
<bookViews>
<workbookView xWindow="120" yWindow="45" windowWidth="18975"
windowHeight="11955" activeTab="2"/>
</bookViews>
<sheets>
<sheet name="chicago" sheetId="1" r:id="rId1" xmlns=""/>
<sheet name="boston" sheetId="2" r:id="rId2" xmlns=""/>
<sheet name="austin" sheetId="3" r:id="rId3" xmlns=""/>
</sheets>
<calcPr calcId="124519"/>
</workbook>
The tool used is MSXML.
I would greatly appreciate if anyone can suggest how to avoid having
xmlns="" in my output tree.
Regards,
Michael
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/
main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships">
<fileVersion appName="xl" lastEdited="4" lowestEdited="4"
rupBuild="4505"/>
<workbookPr defaultThemeVersion="124226"/>
<bookViews>
<workbookView xWindow="120" yWindow="45" windowWidth="18975"
windowHeight="11955" activeTab="2"/>
</bookViews>
<sheets>
<sheet name="chicago" sheetId="1" r:id="rId1"/>
<sheet name="boston" sheetId="2" state="hidden" r:id="rId2"/>
<sheet name="austin" sheetId="3" r:id="rId3"/>
</sheets>
<calcPr calcId="124519"/>
</workbook>
I created a stylesheet to get rid off the 'state' attribute of a
<sheet> elment(s).
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/
Transform"
xmlns:y="http://schemas.openxmlformats.org/spreadsheetml/2006/
main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships"
exclude-result-prefixes="y">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="y:sheet">
<sheet name="{@name}" sheetId="{@sheetId}" r:id="{@r:id}">
<xsl:apply-templates/>
</sheet>
</xsl:template>
</xsl:stylesheet>
And here is the result I get:
<?xml version="1.0"?>
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/
main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/
relationships">
<fileVersion appName="xl" lastEdited="4" lowestEdited="4"
rupBuild="4505"/>
<workbookPr defaultThemeVersion="124226"/>
<bookViews>
<workbookView xWindow="120" yWindow="45" windowWidth="18975"
windowHeight="11955" activeTab="2"/>
</bookViews>
<sheets>
<sheet name="chicago" sheetId="1" r:id="rId1" xmlns=""/>
<sheet name="boston" sheetId="2" r:id="rId2" xmlns=""/>
<sheet name="austin" sheetId="3" r:id="rId3" xmlns=""/>
</sheets>
<calcPr calcId="124519"/>
</workbook>
The tool used is MSXML.
I would greatly appreciate if anyone can suggest how to avoid having
xmlns="" in my output tree.
Regards,
Michael