Stefan, I am trying to something similar and running into a problem. In effect, I am trying to use the form and list module to make it easy for novice users to edit/update records, but when displaying them, make it appear that each record is in its own collapsible container (just like other modules on the page).
To do this, I have made the following XSLT file
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
xsl:output
method
=
"xml"
indent
=
"yes"
omit-xml-declaration
=
"yes"
/>
<!--
This prefix is used to generate module specific query strings
Each querystring or form value that starts with udt_{ModuleId}_param
will be added as parameter starting with param
-->
<
xsl:variable
name
=
"ModID"
><
xsl:value-of
select
=
"//udt:Context/udt:ModuleId"
/></
xsl:variable
>
<
xsl:variable
name
=
"prefix"
>udt_<
xsl:value-of
select
=
"$ModID"
/></
xsl:variable
>
<
xsl:variable
name
=
"prefix_param"
><
xsl:value-of
select
=
"$prefix"
/>_param</
xsl:variable
>
<
xsl:template
match
=
"udt:Data"
mode
=
"list"
>
<
script
language
=
"javascript"
>
function toggle(showHideDiv, switchImgTag)
{
var ele = document.getElementById(showHideDiv);
var imageEle = document.getElementById(switchImgTag);
if(ele.style.display == "block")
{
ele.style.display = "none";
imageEle.innerHTML = '<
img
src
=
"/images/min.gif"
/>';
}
else
{
ele.style.display = "block";
imageEle.innerHTML = '<
img
src
=
"/images/max.gif"
/>';
}
}
</
script
>
<
tr
class
=
"Normal"
>
<
td
>
<
xsl:call-template
name
=
"EditLink"
/>
</
td
>
<
td
>
<
div
class
=
"c_container c_head_c1"
>
<
div
class
=
"c1_tl"
>
<
div
class
=
"c1_tr"
>
<
div
class
=
"c1_tm"
>
<
div
class
=
"head_title"
>
<
h2
class
=
"c_title"
>
<
xsl:value-of
select
=
"udt:Title"
disable-output-escaping
=
"yes"
/>
</
h2
>
</
div
>
<
div
style
=
"float:right;"
>
<
a
id
=
"imageDivLink"
href
=
" toggle('contentDivImg', 'imageDivLink');"
><
img
src
=
"/images/min.gif"
/>
<
xsl:attribute
name
=
"href"
>
toggle('<
xsl:value-of
select
=
"$prefix"
/>_<
xsl:value-of
select
=
"udt:UserDefinedRowId"
/>_ContentPane', 'imageDivLink');
</
xsl:attribute
>
</
a
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"c1_box"
>
<
div
class
=
"c_content"
>
<
div
id
=
"ContentPane"
runat
=
"server"
class
=
"Normal c_contentpane"
>
<
xsl:attribute
name
=
"id"
>
<
xsl:value-of
select
=
"$prefix"
/>_<
xsl:value-of
select
=
"udt:UserDefinedRowId"
/>_ContentPane
</
xsl:attribute
>
<
table
>
<
tr
>
<
td
>
<
xsl:value-of
select
=
"udt:Description"
disable-output-escaping
=
"yes"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
b
>Time:</
b
>
<
xsl:value-of
select
=
"udt:Time"
disable-output-escaping
=
"yes"
/>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
b
>Meeting Point:</
b
>
<
xsl:value-of
select
=
"udt:Meeting_x0020_Point"
disable-output-escaping
=
"yes"
/>
</
td
>
</
tr
>
</
table
>
</
div
>
</
div
>
<
div
class
=
"c_footer"
>
</
div
>
</
div
>
<
div
class
=
"c1_bl"
>
<
div
class
=
"c1_br"
>
<
div
class
=
"c1_bm"
> </
div
>
</
div
>
</
div
>
</
td
>
</
tr
>
</
xsl:template
>
<
xsl:template
match
=
"/udt:UserDefinedTable"
>
<
xsl:variable
name
=
"currentData"
select
=
"udt:Data"
/>
<
xsl:if
test
=
"$currentData"
>
<
table
>
<
xsl:apply-templates
select
=
"$currentData"
mode
=
"list"
>
</
xsl:apply-templates
>
</
table
>
</
xsl:if
>
</
xsl:template
>
<
xsl:template
name
=
"EditLink"
>
<
xsl:if
test
=
"udt:EditLink"
>
<
a
href
=
"{udt:EditLink}"
>
<
img
border
=
"0"
alt
=
"edit"
src
=
"{//udt:Context/udt:ApplicationPath}/images/edit.gif"
/>
</
a
>
</
xsl:if
>
</
xsl:template
>
</
xsl:stylesheet
>
I know that it is not fully baked (I'm just learning this stuff) but when I apply this I get an error message stating:
XSL Tranformation failed. Switched back to Default Grid Table.
StyleSheet:/Portals/0/XslStyleSheets/CommunityTours_test.xsl
Error Description: Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added.
Which is how I found this post in the first place :-)
I know that the offending part is the following segment (found by trial error, not understanding):
<
div
style
=
"float:right;"
>
<
a
id
=
"imageDivLink"
href
=
" toggle('contentDivImg', 'imageDivLink');"
><
img
src
=
"/images/min.gif"
/>
<
xsl:attribute
name
=
"href"
>
toggle('<
xsl:value-of
select
=
"$prefix"
/>_<
xsl:value-of
select
=
"udt:UserDefinedRowId"
/>_ContentPane', 'imageDivLink');
</
xsl:attribute
>
</
a
>
</
div
>
My issue is that I don't understand what the problem is, or how to fix it.
Is there a better way to attempt to mimic the expand/collapse behaviour of a module?
Any suggestions would be great!!