xsl-list
[Top] [All Lists]

Re: [xsl] Help with staregies for outputting an incremental number in xslt

2007-11-29 09:46:09
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/




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--