Avatar billede axiom Nybegynder
16. oktober 2007 - 12:02 Der er 5 kommentarer

XML to CSV, Microsoft Dynamics AIF file to CSV

Hej

Jeg har lidt problemer med at få noget XML data transformeret til CSV.

Jeg har fosøgt at anvende den løsning som findes her http://scitsc.wlv.ac.uk/~jphb/xml/xmlcsv.html til at transformere

Data som skal transformeres, er lavet af AIF i microsoft Dynamics Ax 4.01 (tidl. Axapta), og er en kontoplan. Jeg har lavet en XSL fil som er implementeret i XML'en.

Problem:
1. Hvorfor får jeg kun en post ud ??
2. Hvordan kommer jeg af med det affald som er i starten af det transformerede dokument??

XSL start ->
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:chart="http://schemas.microsoft.com/dynamics/2006/02/documents/ChartOfAccounts"
    xmlns:env="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
<xsl:output method="text"/>
<xsl:template match="/env:Envelope/env:Body/chart:ChartOfAccounts">
<xsl:value-of select="normalize-space(chart:LedgerTable/chart:AccountNum)"/>,<xsl:value-of select="normalize-space(chart:LedgerTable/chart:AccountName)"/>
</xsl:template>
</xsl:stylesheet>
<- slut XSL

XML Start ->
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="GLcsv4.xsl"?>
<Envelope xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
  <Header>
    <MessageId>{0A554C21-CF74-45F4-B5B8-ACF769C6D000}</MessageId>
    <SourceEndpointUser />
    <SourceEndpoint>DMO</SourceEndpoint>
    <DestinationEndpoint>GTM</DestinationEndpoint>
    <Action>findListChartOfAccounts</Action>
    <RequestMessageId />
  </Header>
  <Body>
    <ChartOfAccounts xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/ChartOfAccounts">
      <DocPurpose>Original</DocPurpose>
      <SenderId>dmo</SenderId>
      <LedgerTable class="entity">
        <AccountName>BALANCE SHEET</AccountName>
        <AccountNameAlias>BALANCE</AccountNameAlias>
        <AccountNum>100000</AccountNum>
        <AccountPlType>Heading</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>Yes</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>ASSETS</AccountName>
        <AccountNameAlias>ASSETS</AccountNameAlias>
        <AccountNum>100500</AccountNum>
        <AccountPlType>Heading</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>Yes</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>CURRENT ASSETS</AccountName>
        <AccountNameAlias>CUR ASSETS</AccountNameAlias>
        <AccountNum>110000</AccountNum>
        <AccountPlType>Heading</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>Yes</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>CASH &amp; CASH EQUIVALENTS</AccountName>
        <AccountNameAlias>CASH &amp; CASH EQUIV</AccountNameAlias>
        <AccountNum>110100</AccountNum>
        <AccountPlType>Heading</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Cash in bank - US</AccountName>
        <AccountNameAlias>Cash - US</AccountNameAlias>
        <AccountNum>110110</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>Yes</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <CurrencyCode>USD</CurrencyCode>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>BalanceSheet</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryDimension>
          <element>Optional</element>
          <element>Fixed</element>
          <element>Fixed</element>
        </MandatoryDimension>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Cash in bank -  CAN</AccountName>
        <AccountNameAlias>Cash - CAN</AccountNameAlias>
        <AccountNum>110120</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>Yes</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <CurrencyCode>CAD</CurrencyCode>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>BalanceSheet</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryDimension>
          <element>Optional</element>
          <element>Fixed</element>
          <element>Fixed</element>
        </MandatoryDimension>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Cash in bank - EUR</AccountName>
        <AccountNameAlias>Cash - EUR</AccountNameAlias>
        <AccountNum>110130</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>Yes</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <CurrencyCode>EUR</CurrencyCode>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>Yes</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>BalanceSheet</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryDimension>
          <element>Optional</element>
          <element>Fixed</element>
          <element>Fixed</element>
        </MandatoryDimension>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>Yes</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Cash in bank - DKK</AccountName>
        <AccountNameAlias>Cash - DKK</AccountNameAlias>
        <AccountNum>110140</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>Yes</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <CurrencyCode>DKK</CurrencyCode>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryDimension>
          <element>Optional</element>
          <element>Fixed</element>
          <element>Fixed</element>
        </MandatoryDimension>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Cash in bank - GBP</AccountName>
        <AccountNameAlias>Cash - GBP</AccountNameAlias>
        <AccountNum>110150</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>Yes</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <CurrencyCode>GBP</CurrencyCode>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryDimension>
          <element>Optional</element>
          <element>Fixed</element>
          <element>Fixed</element>
        </MandatoryDimension>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Cash in bank - US (Fixed Asset Purch)</AccountName>
        <AccountNameAlias>Cash - US (FA)</AccountNameAlias>
        <AccountNum>110160</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>Petty cash</AccountName>
        <AccountNameAlias>Petty cash</AccountNameAlias>
        <AccountNum>110180</AccountNum>
        <AccountPlType>AccountStatus</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>No</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>BalanceSheet</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryDimension>
          <element>Optional</element>
          <element>Fixed</element>
          <element>Fixed</element>
        </MandatoryDimension>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>TOTAL CASH &amp; CASH EQUIVALENTS</AccountName>
        <AccountNameAlias>TOT CASH &amp; CASH EQUIV</AccountNameAlias>
        <AccountNum>119000</AccountNum>
        <AccountPlType>sum</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>Yes</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>Yes</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>Yes</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
        <LedgerTableInterval class="entity">
          <AccountRecID>5637146961</AccountRecID>
          <AccountTableId>221</AccountTableId>
          <FromAccount>110100</FromAccount>
          <ReverseSign>No</ReverseSign>
          <ToAccount>119000</ToAccount>
        </LedgerTableInterval>
      </LedgerTable>
      <LedgerTable class="entity">
        <AccountName>SECURITIES</AccountName>
        <AccountNameAlias>SECURITIES</AccountNameAlias>
        <AccountNum>120000</AccountNum>
        <AccountPlType>Heading</AccountPlType>
        <AutoAllocate>No</AutoAllocate>
        <BlockedInJournal>No</BlockedInJournal>
        <BoldTypeface>Yes</BoldTypeface>
        <Closed>No</Closed>
        <ConversionPrinciple>Average</ConversionPrinciple>
        <DebCredBalanceDemand>None</DebCredBalanceDemand>
        <DebCredCheck>None</DebCredCheck>
        <DebCredProposal>None</DebCredProposal>
        <ExchAdjusted>No</ExchAdjusted>
        <Italic>No</Italic>
        <LedgerClosing>None</LedgerClosing>
        <LineExceed>No</LineExceed>
        <LineSub>No</LineSub>
        <MandatoryCurrency>Optional</MandatoryCurrency>
        <MandatoryPosting>Optional</MandatoryPosting>
        <MandatoryUser>Optional</MandatoryUser>
        <Monetary>No</Monetary>
        <Posting>None</Posting>
        <ReverseSign>No</ReverseSign>
        <TaxDirection>None</TaxDirection>
        <TaxFree>No</TaxFree>
        <TotalByPeriod_FR>No</TotalByPeriod_FR>
        <UnderlineNumerals>No</UnderlineNumerals>
        <UnderLineTxt>No</UnderLineTxt>
      </LedgerTable>
    </ChartOfAccounts>
  </Body>
</Envelope>
<-slut XML
Avatar billede janegil Nybegynder
16. oktober 2007 - 15:39 #1
Resultatet jeg får i XMLspy, er:

{0A554C21-CF74-45F4-B5B8-ACF769C6D000}DMOGTMfindListChartOfAccounts100000,BALANCE SHEET

Er det noe av det du kaller 'a
Avatar billede janegil Nybegynder
16. oktober 2007 - 15:45 #2
Hvorfor bare én? Fordi xsl:value-of henter verdien av den første noden som tilfredsstiller select'en.

Prøv:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="http://schemas.microsoft.com/dynamics/2006/02/documents/ChartOfAccounts" xmlns:env="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
    <xsl:output method="text"/>
    <xsl:template match="/env:Envelope/env:Body/chart:ChartOfAccounts">
        <xsl:apply-templates></xsl:apply-templates>
    </xsl:template>
       
    <xsl:template match="chart:LedgerTable">
        <xsl:value-of select="normalize-space(chart:AccountNum)"/>,<xsl:value-of select="normalize-space(chart:AccountName)"/>
    </xsl:template>
</xsl:stylesheet>
Avatar billede janegil Nybegynder
16. oktober 2007 - 15:47 #3
OK, med

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="http://schemas.microsoft.com/dynamics/2006/02/documents/ChartOfAccounts" xmlns:env="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
    <xsl:output method="text"/>
    <xsl:template match="/env:Envelope/env:Body/chart:ChartOfAccounts">
        <xsl:apply-templates></xsl:apply-templates>
    </xsl:template>
       
    <xsl:template match="chart:LedgerTable">
        <xsl:value-of select="normalize-space(chart:AccountNum)"/>,<xsl:value-of select="normalize-space(chart:AccountName)"/><xsl:text>"
        "</xsl:text>
    </xsl:template>
</xsl:stylesheet>

får jeg resultatet

{0A554C21-CF74-45F4-B5B8-ACF769C6D000}DMOGTMfindListChartOfAccountsOriginaldmo100000,BALANCE SHEET"
        "100500,ASSETS"
        "110000,CURRENT ASSETS"
        "110100,CASH & CASH EQUIVALENTS"
        "110110,Cash in bank - US"
        "110120,Cash in bank - CAN"
        "110130,Cash in bank - EUR"
        "110140,Cash in bank - DKK"
        "110150,Cash in bank - GBP"
        "110160,Cash in bank - US (Fixed Asset Purch)"
        "110180,Petty cash"
        "119000,TOTAL CASH & CASH EQUIVALENTS"
        "120000,SECURITIES"
        "

og der ser jeg nok greit at både føste og siste linje er søppel.
Avatar billede janegil Nybegynder
16. oktober 2007 - 16:21 #4
Ikke lykkelig for å liste opp affaldsnodene eksplisitt, men her er et forslag:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="http://schemas.microsoft.com/dynamics/2006/02/documents/ChartOfAccounts" xmlns:env="http://schemas.microsoft.com/dynamics/2006/02/documents/Message">
    <xsl:output method="text"/>   
    <xsl:template match="/chart:Envelope">
        <xsl:apply-templates></xsl:apply-templates>
    </xsl:template>           
    <xsl:template match="chart:LedgerTable">
            <xsl:value-of select="normalize-space(chart:AccountNum)"/>,<xsl:value-of select="normalize-space(chart:AccountName)"/><xsl:text>
</xsl:text>
    </xsl:template>   
    <xsl:template match="env:Header"></xsl:template>
    <xsl:template match="chart:DocPurpose"></xsl:template>
    <xsl:template match="chart:SenderId"></xsl:template>   
</xsl:stylesheet>
Avatar billede janegil Nybegynder
16. oktober 2007 - 16:24 #5
Og åraker til at du får affald, er eksistensen av innebygde template rules, se http://www.w3.org/TR/xslt#built-in-rule
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester