I have installed Contour and is a XSLT newbie, but have started altering the commentlist example from Contour.
I would like to insert member name and profile images form existing member profiles in comment lists, but have difficulties in writing xslt code that validates.
The variable recordMemberID return the member ID corrently, but when inserting the variable in the getmembername Umbraco returns an error when saving "System.OverflowException: Value was either too large or too small for an Int32."
The code looks like this and I would like to insert the variable insetead of 1112:
<xsl:for-eachselect="$records//uformrecord"> <xsl:variablename="recordMemberID"select=".//fields/memberid//value"/> <divclass="record"style="padding-bottom:10px"> <!-- Display 'Name' field of the record, make sure there is a field called 'Name' on the form --> <cite> <xsl:value-ofselect="umbraco.library:GetMemberName(1112)"/> </cite>Says:<br/> <!-- Display the creation time and format it using the umbraco.library method LongDate, each record has a created node that contains the creation datetimestamp --> <small> <xsl:value-ofselect="umbraco.library:LongDate(./created)"/> </small> <div> <!-- Display 'Comment' field of the record, make sure there is a field called 'Comment' on the form --> <xsl:value-ofselect="umbraco.library:ReplaceLineBreaks(.//fields/comment//value)"disable-output-escaping="yes"/> </div> </div> </xsl:for-each>
Check the check box to ignore checking for errors, I think that's getting thrown as when it tries to parse the XML as you sae the document, it doesn't have a value for the member id, so it's passing null to the GetMemberName function which breaks it. If you try that, does work?
I previously used that method, since it seem very logic. It did however return an error (both validation and xslt parsing error). It turned out, that the error was caused by old Contour records with empty memberid values.
Thank you for the correct answer, which led to the solution.
Using member data in comment list
I have installed Contour and is a XSLT newbie, but have started altering the commentlist example from Contour.
I would like to insert member name and profile images form existing member profiles in comment lists, but have difficulties in writing xslt code that validates.
The variable recordMemberID return the member ID corrently, but when inserting the variable in the getmembername Umbraco returns an error when saving "System.OverflowException: Value was either too large or too small for an Int32. "
The code looks like this and I would like to insert the variable insetead of 1112:
<xsl:for-each select="$records//uformrecord">
<xsl:variable name="recordMemberID" select=".//fields/memberid//value" />
<div class="record" style="padding-bottom:10px">
<!-- Display 'Name' field of the record, make sure there is a field called 'Name' on the form -->
<cite>
<xsl:value-of select="umbraco.library:GetMemberName(1112)"/>
</cite> Says: <br />
<!-- Display the creation time and format it using the umbraco.library method LongDate, each record has a created node that contains the creation datetimestamp -->
<small>
<xsl:value-of select="umbraco.library:LongDate(./created)"/>
</small>
<div>
<!-- Display 'Comment' field of the record, make sure there is a field called 'Comment' on the form -->
<xsl:value-of select="umbraco.library:ReplaceLineBreaks(.//fields/comment//value)" disable-output-escaping="yes"/>
</div>
</div>
</xsl:for-each>
Hi Thomas,
Is the member id stored as a field in your form? If so, then you could try something like:
<xsl:value-of select="umbraco.library:GetMemberName($recordMemberID)"/>
Check the check box to ignore checking for errors, I think that's getting thrown as when it tries to parse the XML as you sae the document, it doesn't have a value for the member id, so it's passing null to the GetMemberName function which breaks it. If you try that, does work?
Hi Tim
I previously used that method, since it seem very logic. It did however return an error (both validation and xslt parsing error). It turned out, that the error was caused by old Contour records with empty memberid values.
Thank you for the correct answer, which led to the solution.
Thomas :o)
No worries! Glad you got it working.
:)
is working on a reply...