Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Convert XMl to Excel using XLST

From: "Kram" <mark.macumber@-----.--->
To: NULL
Date: 1/10/2006 9:34:00 PM
Ok its working great, thanks a heap!

But I am having trouble with some of the dynamics of the styles. In the
XML there is an element called "room" this has an attribute called
"name".

I would like for the very first column of the XSL document to have a
row span (i.e. ss:MergeDown) of the number of items within the room
element. Below is what ive got so far (without this new change) could
someone please show me who to do this?

For example, the first room elements name is "Entrance Hall" and it has
10 item elements within it. So I would like it to be like this:

                     - item 1
                     - item 2
                     - item 3
                     - item 4
Entrance Hall  - item 5
                     - item 6
                     - item 7
                     - item 8
                     - item 9
                     - item 10

Hope that makes sense

<?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">

	<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:o="urn:schemas-microsoft-com:office:office"
					xmlns:x="urn:schemas-microsoft-com:office:excel"
					xmlns:html="http://www.w3.org/TR/REC-html40">
			<Styles>
				<Style ss:ID="rotate">
					<Alignment ss:Vertical="Bottom" ss:Rotate="90" />
				</Style>
			</Styles>
			<Worksheet ss:Name="Condition Report">
				<Table>
					<Column ss:AutoFitWidth="0" ss:Width="19.5"/>
					<Column ss:AutoFitWidth="0" ss:Width="150.75"/>
					<Column ss:AutoFitWidth="0" ss:Width="19.5" ss:Span="2"/>
					<Column ss:Index="6" ss:AutoFitWidth="0" ss:Width="161.25"/>
					<Column ss:AutoFitWidth="0" ss:Width="19.5" ss:Span="2"/>
					<Column ss:Index="10" ss:AutoFitWidth="0" ss:Width="161.25"/>
					<Column ss:Index="12" ss:AutoFitWidth="0" ss:Width="72"/>
					<Row>
						<Cell>
							<Data ss:Type="String"></Data>
						</Cell>
						<Cell>
							<Data ss:Type="String"></Data>
						</Cell>
						<Cell ss:MergeAcross="3">
							<Data ss:Type="String">START</Data>
						</Cell>
						<Cell ss:MergeAcross="3">
							<Data ss:Type="String">END</Data>
						</Cell>
					</Row>
					<Row>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Room</Data>
						</Cell>
						<Cell>
							<Data ss:Type="String">Item</Data>
						</Cell>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Good</Data>
						</Cell>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Fair</Data>
						</Cell>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Poor</Data>
						</Cell>
						<Cell>
							<Data ss:Type="String">Other Items &amp; Comments</Data>
						</Cell>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Good</Data>
						</Cell>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Fair</Data>
						</Cell>
						<Cell ss:StyleID="rotate">
							<Data ss:Type="String">Poor</Data>
						</Cell>
						<Cell>
							<Data ss:Type="String">Other Items &amp; Comments</Data>
						</Cell>
					</Row>


					<xsl:for-each select="AreasRoot/room">
						<Row>
							<xsl:for-each select="item">
								<Cell>
									<Data ss:Type="String">
										<xsl:value-of select="conditionBefore"/>
									</Data>
								</Cell>
								<Cell>
									<Data ss:Type="String">
										<xsl:value-of select="conditionAfter"/>
									</Data>
								</Cell>
								<Cell>
									<Data ss:Type="String">
										<xsl:value-of select="commentsBefore"/>
									</Data>
								</Cell>
								<Cell>
									<Data ss:Type="String">
										<xsl:value-of select="commentsAfter"/>
									</Data>
								</Cell>
							</xsl:for-each>
						</Row>
					</xsl:for-each>
				</Table>
			</Worksheet>
			<Worksheet ss:Name="Cover Page">
				<Table>
					<xsl:for-each select="AreasRoot/userDetails">
						<Row>
							<xsl:for-each select="tennant/@*">
								<Cell>
									<Data ss:Type="String">
										<xsl:value-of select="."/>
									</Data>
								</Cell>
							</xsl:for-each>
						</Row>
					</xsl:for-each>
				</Table>
			</Worksheet>
		</Workbook>
	</xsl:template>
</xsl:stylesheet>



Thanks to anyone who helps at all



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