Subject: RE: [xsl] XSLT convert xml file to Excle Question III From: "Rick Roen" <Rick@xxxxxxxxxxxxxxxxxx> Date: Tue, 20 Jun 2006 17:18:01 -0500 |
I'm not exactly sure what you want but perhaps something like this is more like it: <xsl:template match="TAX_CASH_FLOW_ANALYSIS/TaxCashFlowUnit/NoteDetail"> <xsl:comment >inside note detail</xsl:comment> <xsl:for-each select="./*"> <Row> <Cell> <Data ss:Type="String"> <xsl:value-of select="local-name()"/> </Data> </Cell> <Cell ss:Index="3"> <Data ss:Type="String"> <xsl:value-of select="."/> </Data> </Cell> </Row> </xsl:for-each> </xsl:template> Note the "marker" xsl:comment I put inside the node. When you are debugging it is helpful to know if you ever got inside the template. Rick -----Original Message----- From: Karen Yang [mailto:kyang94@xxxxxxxxx] Sent: Tuesday, June 20, 2006 4:38 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] XSLT convert xml file to Excle Question III Hi, Thanks again for those who have replied to me. I appreciate it. Unfortunately, I'm still struggling with the XSLT program. Have been working on it quite some days, been to several websites and read part of the "XSLT cookbook", but still can't make it out. Anyway, here is my problem, I've pasted the XML source, current xslt file, and expected output (I just can't get the NoteDetail node out). Since the deadline is approaching (I guess my boss may look for othre source if I still couldn't have a solution by early tomorrow), any of your reply/help are greatly appreciated. Thanks in advance, Karen. --------------- XML source: <?xml version="1.0" encoding="utf-8"?> <TAX_CASH_FLOW_ANALYSIS UpdateDateTime="2006-06-13T11:26:09.0000000-04:00"> <TaxCashFlowUnit> <NoteDetail> <Collateral>AGGREGATE</Collateral> <NoteDescription>PREMIUM</NoteDescription> <OrigBalance>745850848.91000021</OrigBalance> <OrigCoupon>10.053240586085408</OrigCoupon> <Price>0</Price> <PricePct>0</PricePct> <PricewAI>0</PricewAI> <PricewAIPct>0</PricewAIPct> <CFYield>8.1523988348202181</CFYield> <BEY>0</BEY> </NoteDetail> <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> ----------------- xslt file: <?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> <Table x:FullColumns="1" x:FullRows="1"> <xsl:apply-templates/> </Table> </Worksheet> </Workbook> </xsl:template> <xsl:template match="TAX_CASH_FLOW_ANALYSIS/TaxCashFlowUnit/NoteDetail"> <xsl:for-each select="*/*"> <Row> <Cell><Data ss:Type="String"><xsl:value-of select="local-name()"/></Data></Cell> <Cell ss:Index="3"><Data ss:Type="String"><xsl:value-of select="*/."/></Data></Cell> </Row> </xsl:for-each> </xsl:template> <xsl:template match="TAX_CASH_FLOW_ANALYSIS/TaxCashFlowUnit"> <Row> <xsl:for-each select="*[position() = 2]/*"> <Cell><Data ss:Type="String"> <xsl:value-of select="local-name()"/> </Data></Cell> </xsl:for-each> </Row> <xsl:apply-templates/> </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> </xsl:stylesheet> ------------- Desired output, would be in Excel, but just to put it as text for easy to see. (nodedetail as header, and TaxCashFlowDetail as the table part, also not all children under nodedetail would show up, just the following 5) Collateral AGGREGATE Description: PREMIUM Original Balance 745850848.9 Original Coupon 10.5324059 Cash Flow Yield: 8.15239883 EndingAIP PV PrecapOID OID RemainingOID TaxableIncome QtrInt QtrOID QtrIncome QSI NQSI Principal CurrentBalance MarketDF 786593727.21233881 786593727.21233881 0 0 -35744066.285386205 0 0 0 0 0 0 0 745850848.91000021 0 786593727.21233881 786593727.21233881 0 0 -35744066.285386205 0 0 0 0 0 0 0 745850848.91000021 0 786593727.21233881 786593727.21233881 0 0 -35744066.285386205 0 0 0 0 0 0 0 745850848.91000021 0
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT convert xml file to , J.Pietschmann | Thread | Re: [xsl] XSLT convert xml file to , Wendell Piez |
Re: [xsl] XSLT convert xml file to , J.Pietschmann | Date | [xsl] variable date values..., Robert Wilkins |
Month |