On 05.08.2004 16:39, Hunsberger, Peter wrote:

I added this to my forms-field-styling.xsl in the template for
<fi:form-template>:

              <xsl:if test="descendant::node()/fi:upload">
                        <xsl:attribute
name="enctype">multipart/form-data</xsl:attribute>
              </xsl:if>

Good idea, or bad?

I'm not very fond of it, since this needs to scan the whole tree below the form-template, which might be large (if it contains lots of widgets or large selection lists), combined with the fact that most forms don't use uploads anyway. Just IMHO of course.
I suppose it may depend on the XSLT processor, but if you didn't have to
use the descendant axes this could be ok. Not knowing the structure of
the Cforms templates I don't know if you can avoid descendant, but if it
maps to a regular XHTML form then shouldn't the fi:upload element always
be a fixed number of steps away from the context of this test? IE;
allowing for some kind of grouping a test like:


        test="./fi:upload or ./group/fi:upload"

would avoid scanning the whole tree (and in particular the contents of
things like lists)...

Not possible. The stylesheets work on the templates, which can contain any markup at any depth.


Joerg

Reply via email to