[xsl] Adding form elements captured from xml

Subject: [xsl] Adding form elements captured from xml
From: "Aaron Johnson" <artpunx@xxxxxxxxx>
Date: Fri, 11 Apr 2008 11:22:37 +0100
Hi...

I have a set of choose / if tests which collect deBug information,
which, I would like to add to the top of a web form as a hidden field.

This is how I collect the deBug...

<div class="smallText errorText">Debug:</div>
<div class="smallText">
Current focused tab: <xsl:value-of select="//focusedTab/@name"/>
<xsl:choose>
<xsl:when test="count(//folder) &gt; 1">
<br  />
Current focused sub tab: <xsl:value-of
select="//layout/subtabs/folder/folder[@isFocused='true']/@name"/>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(//channel[@minimized='false']) &gt; 0">
<br  />
Current visible channels:  <xsl:for-each
select="//channel[@minimized='false']/@title"> <xsl:value-of
select="."/>, </xsl:for-each>
</xsl:if>
<xsl:if test="count(//channel[@minimized='true']) &gt; 0">
<br  />
Current hidden channels:  <xsl:for-each
select="//channel[@minimized='true']/@title"> <xsl:value-of
select="."/>, </xsl:for-each>
</xsl:if>
<xsl:if test="//focusedContent">
<br />
Current maximised channel: <xsl:value-of
select="//focusedContent/channel/@title"/>
</xsl:if>
</div>

I imagined that I could do something similar a little like
this....where 'foo' would be the value collected by the xsl:for-each
element.

<div id="hiddenChannelStats">
<input type="hidden" name="Current focused tab:" value="" />
<xsl:choose>
<xsl:when test="count(//folder) &gt; 1">
<input type="hidden" name="Current focused sub tab:" id="" value="" />
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count(//channel[@minimized='false']) &gt; 0">
<input type="hidden" name="Current visible channels:" value="" />
</xsl:if>
<xsl:if test="count(//channel[@minimized='true']) &gt; 0">
<input type="hidden" name="Current hidden channels:" value="" />
</xsl:if>
<xsl:if test="//focusedContent">
<input type="hidden" name="Current maximised channel:" value="" />
</xsl:if>
</div>

...but you can't put the <xsl:for-each> elements inside the value=""
because it's not valid code.

can anyone give me any advice?

Thanks....

Aaron

NB: Here is the xml....

<layout userLayoutRoot="root"
	targetAction="no%20targetAction%20parameter"
	targetRestriction="no%20targetRestriction%20parameter"
	focusedTabID="331-2" selectedID="" mode="view"
	lastSessionTabID="no lastSessionTabID parameter" immutable="false"
	unremovable="true" current_structure="layout" authenticated="true">
	<restricted vals=",column1,column2,main-column,"/>
	<topLevelTab ID="1120"/>
	<homeId ID="1120"/>
	<header/>
	<subtabs>
		<folder isFocused="true" ID="1120" type="regular" hidden="false"
			unremovable="true" immutable="true" name="Home"
			priority="38000" width="100">
			<folder isFocused="true" ID="331-2" type="regular"
				hidden="false" unremovable="true" immutable="true"
				name="Welcome" priority="2147483646" width="100"/>
			<folder ID="331-10" type="regular" hidden="false"
				unremovable="true" immutable="true" name="Library"
				priority="2147483645" width="100"/>
			<restriction isFocused="true" path="local" value="380-380"
				type="priority"/>
			<restriction isFocused="true" path="local" value="1" type="depth"/>
		</folder>
	</subtabs>
	<navigation>
		<focusedTab hasSubTabs="true" unremovable="true"
			immutable="true" ID="1120" name="Home"/>
		<inactiveTab hasSubTabs="true" unremovable="true"
			immutable="true" ID="1123" name="Marks"/>
		<inactiveTab hasSubTabs="true" unremovable="true"
			immutable="true" ID="1122" name="My Details"/>
		<inactiveTab hasSubTabs="false" unremovable="true"
			immutable="true" ID="1121" name="Email"/>
	</navigation>
	<content>
		<column unremovable="true" immutable="true" ID="331-3" width="50">
			<channel ID="331-4" typeID="-1" hidden="false"
				editable="false" unremovable="true" immutable="true"
				name="Welcome to myUWE"
				description="Post Login Welcome Portlet"
				title="Post Login Welcome Portlet"
				class="uk.ac.uwe.atg.portal.channels.welcome.PostLoginWelcome"
				chanID="135" fname="postLoginWelcome" timeout="20000"
				hasHelp="false" hasAbout="false" secure="false"
				isPortlet="false" priority="2147483646" minimized="false"/>
			<channel ID="331-5" typeID="11" hidden="false"
				editable="true" unremovable="true" immutable="true"
				name="News" description="RSS portlet"
				title="RSS Portlet"
				class="org.jasig.portal.channels.portlet.CPortletAdapter"
				chanID="126" fname="rssPortlet" timeout="20000"
				hasHelp="false" hasAbout="false" secure="false"
				isPortlet="true" priority="2147483645" minimized="true">
				<parameter name="portletDefinitionId"
					value="rssPortlet.RSSPortlet" override="no"/>
			</channel>
		</column>
		<column unremovable="true" immutable="true" ID="331-6" width="50">
			<channel ID="331-7" typeID="11" hidden="false"
				editable="false" unremovable="true" immutable="true"
				name="Announcements" description="Announcements portlet"
				title="Announcements Portlet"
				class="org.jasig.portal.channels.portlet.CPortletAdapter"
				chanID="103" fname="announcementsPortlet"
				timeout="20000" hasHelp="false" hasAbout="false"
				secure="false" isPortlet="true" priority="2147483646"
				minimized="false">
				<parameter name="portletDefinitionId"
					value="announcementsPortlet.AnnouncementsPortlet"
					override="no"/>
			</channel>
			<channel ID="331-8" typeID="11" hidden="false"
				editable="false" unremovable="true" immutable="true"
				name="Blackboard Announcements"
				description="Blackboard Announcements channel"
				title="Blackboard Announcements"
				class="org.jasig.portal.channels.portlet.CPortletAdapter"
				chanID="106" fname="bbBuildingBlockAnnouncements"
				timeout="20000" hasHelp="false" hasAbout="false"
				secure="false" isPortlet="true" priority="2147483645"
				minimized="true">
				<parameter name="portletDefinitionId"
					
					value="blackboardPortlet.BlackboardPortlet_Announcements"
					override="no"/>
			</channel>
			<channel ID="331-9" typeID="11" hidden="false"
				editable="true" unremovable="true" immutable="true"
				name="Bookmarks" description="Bookmarks"
				title="Bookmarks"
				class="org.jasig.portal.channels.portlet.CPortletAdapter"
				chanID="108" fname="bookmarks" timeout="20000"
				hasHelp="false" hasAbout="false" secure="false"
				isPortlet="true" priority="2147483644" minimized="false">
				<parameter name="portletDefinitionId"
					value="bookmarksPortlet.BookmarksPortlet" override="no"/>
			</channel>
		</column>
	</content>
	<footer/>
</layout>

Current Thread