[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Help with staregies for outputting an incremental

Subject: Re: Help with staregies for outputting an incremental number in xslt
From: Adam Lipscombe <adam.lipscombe@xxxxxxxxxx>
Date: Thu, 29 Nov 2007 16:45:36 +0000
Re:  Help with staregies for outputting an incremental
Michael

Thanks for that. What I mean by omitted nodes is that my transform does not output some of the nodes.


> Incidentally, please don't do this: > >> <xsl:variable name="description"> >> <xsl:value-of select="../../expensys:ItemDescription"/> >> </xsl:variable> > > when you mean this: > >> <xsl:variable name="description" > select="../../expensys:ItemDescription"/>

Point taken - thanks. I do n ot understand the difference between these constructs. Could you advise?




Here is a snippet of the input xml file:


<Transaction transactionType="CorporateCardReconciliation">
    <Header>
      <TransactionIdentifier><![CDATA[CC-DD101-S1]]></TransactionIdentifier>
      <EnterpriseLevel><![CDATA[ACME Engineering]]></EnterpriseLevel>
      <ClaimantName><![CDATA[Dolores Delegate]]></ClaimantName>
      <ClaimantIdentifier><![CDATA[DD101]]></ClaimantIdentifier>
      <Description><![CDATA[BarclayCard Statement: 01/02/2007]]></Description>
      <Currency><![CDATA[GBP]]></Currency>
      <CreationDate><![CDATA[2007-11-29T00:00:00+00:00]]></CreationDate>
      <ApprovedDate><![CDATA[2007-11-29T00:00:00+00:00]]></ApprovedDate>
      <ProcessedDate><![CDATA[2007-11-29T00:00:00+00:00]]></ProcessedDate>
      <TransactionAmount>
        <value><![CDATA[20.00]]></value>
        <sense><![CDATA[credit]]></sense>
      </TransactionAmount>
      <Approvers>
        <Approver><![CDATA[Eddie Executive]]></Approver>
      </Approvers>
      <StatementDate><![CDATA[2007-02-01T00:00:00+00:00]]></StatementDate>
      <StatementAmount><![CDATA[35.00]]></StatementAmount>
      <CorporateCardSettlementType><![CDATA[personal]]></CorporateCardSettlementType>
    </Header>
    <Lines>
      <Line>
        <ItemDescription><![CDATA[Personal Spend]]></ItemDescription>
        <ItemNumber><![CDATA[1]]></ItemNumber>
        <SpendDate><![CDATA[2007-01-08T00:00:00+00:00]]></SpendDate>
        <CostCentre>
          <costCentreCode><![CDATA[CC1]]></costCentreCode>
        </CostCentre>
        <ProjectCode><![CDATA[CODE01]]></ProjectCode>
        <Accruals>
          <Accrual>
            <accountCode><![CDATA[999998]]></accountCode>
            <amount>
              <value><![CDATA[15.00]]></value>
              <sense><![CDATA[debit]]></sense>
            </amount>
          </Accrual>
        </Accruals>
      </Line>
      <Line>
        <ItemDescription><![CDATA[test dol]]></ItemDescription>
        <ItemNumber><![CDATA[2]]></ItemNumber>
        <SpendDate><![CDATA[2007-01-08T00:00:00+00:00]]></SpendDate>
        <CostCentre>
          <costCentreCode><![CDATA[CC1]]></costCentreCode>
        </CostCentre>
        <ProjectCode><![CDATA[CODE01]]></ProjectCode>
        <Accruals>
          <Accrual>
            <accountCode><![CDATA[100102]]></accountCode>
            <amount>
              <value><![CDATA[20.00]]></value>
              <sense><![CDATA[debit]]></sense>
            </amount>
          </Accrual>
        </Accruals>
      </Line>
    </Lines>
  </Transaction>



The first line above has the description "Personal Spend". I dont want to output this line in the transform, if (and only if) the transactionType="CorporateCardReconciliation" AND the CorporateCardSettlementType="personal".

In this scenario the first line should the Line that has description = "test dol", however its txn:Number shoudl be "1", not "2".
In all other circumstances the "Personal Spend" line should be output as normal.




Any ideas?


TIA - Adam







Michael Kay wrote:
I don't understand what you mean by "omitted nodes" (I have trouble
discussing non-existent objects). If position() counts it, then it must be
there. Please show us your XML to illustrate what you are talking about.

Incidentally, please don't do this:

   <xsl:variable name="description">
     <xsl:value-of select="../../expensys:ItemDescription"/>
   </xsl:variable>

when you mean this:


<xsl:variable name="description"
select="../../expensys:ItemDescription"/>

It's the kind of thing that gives XSLT an undeserved reputation for being
verbose and slow.

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.