Share this Page URL
Help

Chapter 7. Using SpreadsheetML > Creating XML Spreadsheets - Pg. 351

> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" encoding="US- ASCII"/> <xsl:template match="ss:Workbook"> <dinosaurs> <xsl:apply-templates select="ss:Worksheet[@ss:Name = 'Sheet1']"/> </dinosaurs> </xsl:template> <xsl:template match="ss:Worksheet"> <date><xsl:value-of select="ss:Table/ss:Row/ss:Cell[ss:NamedCell/@ss:Name = 'Date']" /></date> <xsl:apply-templates select="ss:Table" /> <total><xsl:value-of select="ss:Table/ss:Row/ss:Cell[ss:NamedCell/@ss:Name = 'GrandTotal']" /></total> </xsl:template> <xsl:template match="ss:Table"> <xsl:apply-templates select="ss:Row[position( ) &gt; 2]" /> </xsl:template> <!--Only create sale elements for Rows which start with an ID--> <xsl:template match="ss:Row[ss:Cell[1]/ss:NamedCell/@ss:Name='ID']"> <sale> <IDnum><xsl:apply-templates select="ss:Cell[ss:NamedCell/@ss:Name='ID']" /> </IDnum> <critter><xsl:apply-templates select="ss:Cell[ss:NamedCell/@ss:Name='Critters']" /></critter> <price><xsl:apply-templates select="ss:Cell[ss:NamedCell/@ss:Name='Price']" /> </price> <quantity><xsl:apply-templates select="ss:Cell[ss:NamedCell/@ss:Name='Quantity']" /></quantity> <total><xsl:apply-templates select="ss:Cell[ss:NamedCell/@ss:Name='Total']" /> </total> </sale> </xsl:template> <xsl:template match="ss:Row" /> </xsl:stylesheet>