[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: RE: [xsl] Help with staregies for outputting an incremental number in xslt
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 29 Nov 2007 17:03:45 -0000

>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".

position() counts the nodes that are selected by for-each or by
apply-templates. So if you don't want these nodes counted, don't select
them:

<xsl:for-each select="Line[not(ItemDescription='PersonalSpend' and
transactionType='CorporateCardReconciliation' and
CorporateCardSettlementType='personal']>

.... 

>  > 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?

The first one builds a result tree fragment consisting of a document node
and a text node, whose value is a copy of the text of an existing node. The
second one is (a pointer to) an existing node. Creating new nodes and
copying text is expensive, and in this case is quite unnecessary.

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


Current Thread