Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Help! How Import XML Using xsl:copy-of & document()? >Thread Next - Re: Help! How Import XML Using xsl:copy-of & document()? Re: Help! How Import XML Using xsl:copy-of & document()?To: NULL Date: 2/3/2006 2:58:00 PM Following are excerpts from the relevant files. I removed data rom the
Row elements for the sake of brevity.
============= MAIN.XSL ==============
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-10-15T23:33:16">
<xsl:include href="header.xsl"/>
<xsl:template match="/">
<xsl:processing-instruction name="mso-application">
<xsl:text>progid="excel.sheet"</xsl:text>
</xsl:processing-instruction>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:copy-of select='document("styles.xml")'/>
<Worksheet ss:Name="Hardware Quote" ss:Protected="1">
<Table x:FullColumns="1" x:FullRows="1">
<Column ss:AutoFitWidth="0" ss:Width="45"/>
<Column ss:AutoFitWidth="0" ss:Width="25"/>
<Column ss:AutoFitWidth="0" ss:Width="40"/>
<Column ss:AutoFitWidth="0" ss:Width="135.75"/>
<xsl:apply-templates/>
<Row />
<Row />
<Row />
<Row />
</Table>
</Worksheet>
</Workbook>
</xsl:template>
</xsl:stylesheet>
============= HEADER.XSL ==============
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-10-15T23:33:16">
<xsl:template match="/">
<Header>
<Row ss:AutoFitHeight="0" ss:Height="18" ss:StyleID="s52">
<Cell ss:StyleID="s49"><Data ss:Type="String">COMPANY
NAME</Data></Cell>
<Cell ss:StyleID="s49"/>
<Cell ss:StyleID="s47"><Data
ss:Type="String">Customer:</Data></Cell>
<Cell ss:StyleID="s77"><Data ss:Type="String"><xsl:value-of
select="/my:CMSProject/my:CustomerName"/></Data></Cell>
<Cell ss:StyleID="s64"/>
<Cell ss:StyleID="s64"/>
</Row>
</Header>
</xsl:template>
</xsl:stylesheet>
====================================
If I apply the header.xsl transform to my tempdata.xml file I get the
header rows I want. They transform to well-formed XML. So that works by
itself. But when I include header.xsl in the main XSL and call
apply-templates, it ends up just inserting the text from all of the
tempdata.xml nodes. They don't even come over as XML.
I guess I could run header.xsl on tempdata.xml first and then use
<xsl:copy-of select='document("header.xml")'/>, but I'm hoping for a
more elegant solution that involves a one-time transform using included
XSL.
Patrick
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
