|
Subject: [xsl] Convert XML to Excel using XSLT Question II. From: "Karen Yang" <kyang94@xxxxxxxxx> Date: Mon, 19 Jun 2006 17:45:40 -0400 |
Thank you all for answering my earlier question. This second question is related to <xsl:apply-templates>.
In the code I attached, in line 22, if I put <xsl:apply-templates select = "/"> then a infinite loop will occur. How does it come a loop? I couldn't understand. Also, the result Excel/XML file have the output of "<Cell xmlns="urn:schemas-microsoft-com:office:spreadsheet"><Data ss:Type="String" xmlns="urn:schemas-microsoft-com:office:spreadsheet">0</Data></Cell>", I don't understand how come the cell element has the xmlns attribute? How did this happen?
Karen. --------- <?xml version='1.0' encoding='utf-8'?>
<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"> <!-- <Worksheet> <xsl:attribute name="ss:Name"> <xsl:value-of select="name(/*/*/*)"/> </xsl:attribute> --> <xsl:apply-templates/> <!-- </Worksheet> --> </Workbook> </xsl:template>
<!-- <xsl:template match="/*/*"> <Worksheet> <xsl:attribute name="ss:Name"> <xsl:value-of select="name(/*/*)"/> </xsl:attribute> <xsl:apply-templates/> </Worksheet> </xsl:template> --> <!--<xsl:template match="NoteDetail"> test <xsl:apply-templates/> </xsl:template> -->
<xsl:template match="TAX_CASH_FLOW_ANALYSIS/TaxCashFlowUnit">
<Table x:FullColumns="1" x:FullRows="1">
<Row>
<xsl:for-each select="*[position() = 1]/*">
<Cell><Data ss:Type="String">
<xsl:value-of select="local-name()"/>
</Data></Cell>
</xsl:for-each>
</Row>
<xsl:apply-templates/>
</Table>
</xsl:template><xsl:template match="TAX_CASH_FLOW_ANALYSIS/TaxCashFlowUnit/TaxCashFlowDetail"> <Row> <xsl:apply-templates/> </Row> </xsl:template>
<xsl:template match="TAX_CASH_FLOW_ANALYSIS/TaxCashFlowUnit/TaxCashFlowDetail/*"> <Cell><Data ss:Type="String"> <xsl:value-of select="."/> </Data></Cell> </xsl:template>
-------------------- xml source:
<?xml version="1.0" encoding="utf-8"?>
<TAX_CASH_FLOW_ANALYSIS UpdateDateTime="2006-06-13T11:26:09.0000000-04:00">
<TaxCashFlowUnit>
<TaxCashFlowDetail>
<EndingAIP>786593727.21233881</EndingAIP>
<PV>786593727.21233881</PV>
<PrecapOID>0</PrecapOID>
<OID>0</OID>
<RemainingOID>-35744066.285386205</RemainingOID>
<TaxableIncome>0</TaxableIncome>
<QtrInt>0</QtrInt>
<QtrOID>0</QtrOID>
<QtrIncome>0</QtrIncome>
<QSI>0</QSI>
<NQSI>0</NQSI>
<Principal>0</Principal>
<CurrentBalance>745850848.91000021</CurrentBalance>
<MarketDF>0</MarketDF>
</TaxCashFlowDetail>
<TaxCashFlowDetail>
<EndingAIP>786593727.21233881</EndingAIP>
<PV>786593727.21233881</PV>
<PrecapOID>0</PrecapOID>
<OID>0</OID>
<RemainingOID>-35744066.285386205</RemainingOID>
<TaxableIncome>0</TaxableIncome>
<QtrInt>0</QtrInt>
<QtrOID>0</QtrOID>
<QtrIncome>0</QtrIncome>
<QSI>0</QSI>
<NQSI>0</NQSI>
<Principal>0</Principal>
<CurrentBalance>745850848.91000021</CurrentBalance>
<MarketDF>0</MarketDF>
</TaxCashFlowDetail>
<TaxCashFlowDetail>
<EndingAIP>786593727.21233881</EndingAIP>
<PV>786593727.21233881</PV>
<PrecapOID>0</PrecapOID>
<OID>0</OID>
<RemainingOID>-35744066.285386205</RemainingOID>
<TaxableIncome>0</TaxableIncome>
<QtrInt>0</QtrInt>
<QtrOID>0</QtrOID>
<QtrIncome>0</QtrIncome>
<QSI>0</QSI>
<NQSI>0</NQSI>
<Principal>0</Principal>
<CurrentBalance>745850848.91000021</CurrentBalance>
<MarketDF>0</MarketDF>
</TaxCashFlowDetail>
</TaxCashFlowUnit>
</TAX_CASH_FLOW_ANALYSIS>| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Re: XSLT help., Karen Yang | Thread | RE: [xsl] Convert XML to Excel usin, Michael Kay |
| Re: [xsl] Re: XSLT help., Karen Yang | Date | RE: [xsl] Convert XML to Excel usin, Michael Kay |
| Month |