Ok, Im having some troubles fully grasping XSL. Its hard to explain with out showing so first..this is what i have so far.
the if statement in there (line 69) is incorrect. How can I get the desired test statement to put the correct data in?
Code:
<xsl:stylesheet version='1.0' xmlns='urn:schemas-microsoft-com:office:spreadsheet' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-microsoft-com:xslt' xmlns:user='urn:my-scripts' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet' > <xsl:template match='/'> <Workbook xmlns='urn:schemas-microsoft-com:office:spreadsheet' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet' xmlns:html='http://www.w3.org/TR/REC-html40'> <xsl:apply-templates/> </Workbook> </xsl:template> <xsl:variable name='header'> <columnName>Column 1</columnName> <columnName>Column 2</columnName> <columnName>Column 3</columnName> </xsl:variable> <xsl:template match='/*'> <Worksheet> <xsl:attribute name='ss:Name'> <xsl:value-of select='local-name(/*/*)'/> </xsl:attribute> <Table x:FullColumns='1' x:FullRows='1'> <!--header--> <xsl:for-each select='msxsl:node-set($header)/*'> <Column ss:Width='120'/> </xsl:for-each> <Row> <xsl:for-each select='msxsl:node-set($header)/*'> <Cell ss:StyleID='s21'> <Data ss:Type='String'> <xsl:value-of select='.'/> </Data> </Cell> </xsl:for-each> </Row> <!--/header--> <xsl:apply-templates/> </Table> </Worksheet> </xsl:template> <!--each row--> <xsl:template match='/*/*'> <Row> <xsl:variable name = 'cNodeName'> <xsl:value-of select='local-name()'/> </xsl:variable> <xsl:variable name = 'cNodeData'> <xsl:value-of select='.'/> </xsl:variable> <xsl:for-each select='msxsl:node-set($header)/*'> <xsl:if test='$cNodeName=.'> <Cell> <Data ss:Type='String'> <xsl:value-of select='$cNodeData'/> </Data> </Cell> </xsl:if> </xsl:for-each> </Row> </xsl:template> <!--/each row--> </xsl:stylesheet>
Comment