Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Convert XMl to Excel using XLST >Thread Next - Re: Convert XMl to Excel using XLST Re: Convert XMl to Excel using XLSTTo: NULL Date: 1/11/2006 3:36:00 PM Think you need something like this ...
<Worksheet ss:Name="Sheet1">
<Table>
<xsl:for-each select="AreasRoot/room">
<xsl:for-each select="item">
<Row>
<xsl:if test="position()=1">
<Cell ss:MergeDown="3">
<Data ss:Type="String"><xsl:value-of
select="../@name"/></Data>
</Cell>
</xsl:if>
<xsl:for-each select="*">
<Cell>
<xsl:attribute name="ss:Index">
<xsl:value-of select="position() + 1"/>
</xsl:attribute>
<Data ss:Type="String">
<xsl:value-of select="."/>
</Data>
</Cell>
</xsl:for-each>
</Row>
</xsl:for-each>
</xsl:for-each>
</Table>
</Worksheet>
--
Naraendira Kumar R.R.
~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Kram" <mark.macumber@g...> wrote in message
news:1136957621.598769.314410@f......
> 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 & 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 & 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
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
