Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Help! How Import XML Using xsl:copy-of & document()?

From: "PaddyInHR" <pmbarnes@-----.--->
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



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent