Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jo Ward 5 posts 25 karma points
    Apr 26, 2013 @ 08:03
    Jo Ward
    0

    Sending an xslt transformed email from Contour - looping on fieldset

    Hi guys,

    I'm new to xslt but have managed to tweak the sample xslt file to layout an email in a format more to my liking, however I've hit a bit of wall when working out how to reference a set of repeated fields. 

    Our form asks for basic contact details, followed by a number of repeating fields ie.

    NAME:
    ADDRESS::

    TITLE:
    AUTHOR:
    JOURNAL:
    YEAR, VOL & ISS, PAGES:

    TITLE:
    AUTHOR:
    JOURNAL:
    YEAR, VOL & ISS, PAGES:

    TITLE:
    AUTHOR:
    JOURNAL:
    YEAR, VOL & ISS, PAGES:

    I can pull the first instance of Title like so :

    <xsl:value-of select="$records//fields/child::* [caption[1] = 'Title']//value"/>
    <xsl:value-of select="$records//fields/child::* [caption[1] = 'Author']//value"/>
    etc..

    but i'm having difficulty getting the 2nd and 3rd sets. I would have thought 

    <xsl:value-of select="$records//fields/child::* [caption[2] = 'Title']//value"/>
    <xsl:value-of select="$records//fields/child::* [caption[2] = 'Author']//value"/>
    etc.

    would work, but I get nothing. Any pointers?

    Additionally, the repeated fields are contained within a fieldset, so each instance of a field has a fieldsetindex attribute. Is it at all possible to use fieldsetindex to loop through each fieldset in turn and output the value of each of these fields?

    Ultimately, I'd like to update the form to allow the user to add as many of these repeated fields as they need, so pulling the data via a loop is by the preferred option...

    All help very much appreciated!

Please Sign in or register to post replies

Write your reply to:

Draft