cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Bierenfeld <michael.bierenf...@atmiralis.de>
Subject Dynamic attributes from xsp to xslt
Date Fri, 06 Oct 2000 13:06:18 GMT
Hello,

I am trying to figure out how the following can be
done.

--------------------------------------------------------
1) XML-File :

<form name="form1" action="/whatever.xml"
method="post">

	... some content ...

</form>

and another like

<form name="hallo2" action="/whatever.xml"
method="post"
	enctype="multipart/form-data">

	... some content ...

</form>

so form1 contains no enctype-attribute but form2
does.
If enctype is not given, the default should be
used

--------------------------------------------------------
2) this is caught by an xsp :

<xsl:template match="form">

	<!-- do some java stuff -->

	<xsp:logic>

		String listMode = null;
		int listCount = 0;

		InputHash inputHash = engine.getInputHash
(request);

	</xsp:logic>

	<!-- create a form -->
	<!-- check if attribute enctype is given. if not
set it to text/plain -->

	<xsl:variable name="tmpenctype">

		<xsl:choose>

		<xsl:when test="@enctype">
			<xsl:value-of select="@enctype"/>
		</xsl:when>

		<xsl:otherwise>
			text/plain
		</xsl:otherwise>

		</xsl:choose>

	</xsl:variable>

	<!-- fire <form> for futher xslt processing -->

	<form name="{@name}" action="{@action}"
method="{@method}"
	 enctype="{$tmpenctype}">

		<xsl:apply-templates/>

	</form>
	
<xsl:template>

------------------------------------------------
3) that is furthermore processed by xsl

<xsl:template match="form">

	<!-- Send out HTML-Stuff to be displayed -->
	
	<form action="{@action}" method="{@method}"
		 name="{@name}" enctype="{enctype}">
		<xsl:apply-templates/>
	</form>

</xsl:template>

So xsp "catchs" <form> and "sends" <form> to xslt.
Is it possible to transfer all parameters even
without knowing them ? Cause XSP should not be
worried about Layouts or something like that. Just
pass the parameters. If they are there send them
if not just dont send them.

This is valid for a lot of things eg. <img> where
you specify height, width and so on. If you would
catch this in xsp (to get it out of a database or
so) you would be worried about the imagename but
now for the layout-attributes of the html-tag
<img>.

Regards

Michael

PS: I will never do it again. My Mailbox is
somewhat spoiled. But anyway I think this gives a
good feeling about using cocoon.

Mime
View raw message