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.
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...
If anyone is interested, I managed to solve this by repeating on one of the repeating fields, and using 'following-sibling' to get the values of the others ie:
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!
Comment author was deleted
Hmmm could you try <xsl:value-of select="$records//fields/child::* [caption = 'Title'][2]//value"/>
Hi Tim,
Thanks for that - it works! Much appreciated.
Now, if anyone has any ideas how I can loop!??!?!
If anyone is interested, I managed to solve this by repeating on one of the repeating fields, and using 'following-sibling' to get the values of the others ie:
is working on a reply...