Thread: counting in XSL
View Single Post
  #1 (permalink)  
Old March 26th, 2006, 02:15 AM
gezi gezi is offline
Registered User
 
Join Date: Mar 2006
Location: Sunland, California, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default counting in XSL

Hi,
I looked far and wide on how to solve this problem, so now I have to ask ;)

I have all my address data in an xml file and have succeded with a nice xslt to transform and display the addressdata in any browser in well human-readable form.

Now I wanted to use the same xml data to create a file with vCard entries. Not so difficult, except that there are some of my fieds that do not map to any vCard field and also I have several NOTE fields while vCard has only one. So I have to collect all the NOTES and additional fields and stick them all into the one NOTE field in vCard.

For this sticking I have to concatenate all these elements with a =0A=0D as line separator, but the problem is that the first element that goes into that NOTE field has to be different. So I need something to flag the first usage of my template that matches all these extra fields.

I need something like (where all these elements are the ones I want to group into the one NOTE element):

<xsl:template match="NO|MS|OF|VM|WB|PG|BX|BB|CT">
if first time then
NOTE;ENCODING=QUOTED-PRINTABLE:<xsl:value-of select="."/>
else
=0D=0A<xsl:value-of select="."/>
</xsl:template>

Ho do you do this in in XSLT - I tried xsl:script but this appears to work only under conditions that are not true for me, like IE/MSXML - I use firefox.

Thanks for any hint you might be able to give me.
Gunter