You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bram <br...@info.nl> on 2000/12/15 17:19:48 UTC
Input tag and xml
Hi,
I have noticed the following, when I make a form using struts, with radio, checkbox and hidden fields,
and later on do an xsl transformation over the "xhtml" the xhtml is invalid. the <form:hidden> and other Basefieldtags
are rendered as <input type="xxx"> > (without the / )
is there a reason that it is not rendered as <input type="xxx"/> (with the / )
or <input type="xxx"></input> so I can "transform" it lateron?
Thanx
Bram Meijboom
Re: Re[4]: Input tag and xml
Posted by bram <br...@info.nl>.
Hi Matthias,
> a) It's invalid (HTML)
> I've nether found it worth in-the-long-term to implement something against
> a clearly written spec just as workaround for other problems. It doesn't
pay.
> Of course, this is not a real argument but just my personal opinion.
>
agreed, theory is great, but it doesn't have to work in the "real" world
> b) struts-form is not for XHTML
> The tags are used to (and intended to) generate HTML, not XHTML or XML.
> The reason to add the forbidden closing tag was - if I remember
correctly -
> to be able to use the generated document as input for XSLT. While I would
> too like the ability to use Struts to generate output in different markup
> languages (like XHTML1.0, WML or ....), it seems obvious, that each
> markup language has it's own feature set and the approach to use a single
> tag library for each and any markup language is doomed to fail.
> A better approach IMHO would be to have different (form-)taglibs (one for
> each markup language) and to switch between them with the
taglib-directive.
>
> c) (just) changing input would be "patchwork"
> This is not the only occurrence where HTML differs from XHTML in a way
that
> prevents XSLT. What's about minimized boolean attributes (like selected,
> checked, disabled and so on...). Struts generates them in their minimized
> form, also being invalid XHTML. So, if it has to be done and I'm the only
> one seeing problems with this kind of changes, it should be done _right_,
> i.e. all occurrence should be properly changed and it should be
documented,
> that the form taglib is intended to generated XHTML (or HTML _and_ XHTML).
>
> Comments ?
> --
> Matthias (mailto:make@BESToffers.de)
>
Hmm, ok didn't thought about the "minimized" boolean attributes, and yeah,
it is a messy solution to just add a "/",
maybe an kind of global setting (read a form attribute eg
"output-type=html:xhtml|xml") could do the trick.
otherwise the "different taglib for the different markup languages " method
sould be used.
Bram
Re[4]: Input tag and xml
Posted by Matthias Kerkhoff <ma...@BESToffers.de>.
Bram,
>> "Luckily" all variants break Netscape 4.7x. (No input tag at all :)
> dunno what ns browser you used, but it works fine here, (maybe forgot the
> "form" tags?)
Yes, you're right. I was in a hurry and just ommitted the form. (I also
used NS 4.76, btw.)
So, at first, it doesn't look as if adding (this specific kind of) invalid
html to the output any problems. I still have some objections against doing
so, that I tried to explain below.
a) It's invalid (HTML)
I've nether found it worth in-the-long-term to implement something against
a clearly written spec just as workaround for other problems. It doesn't pay.
Of course, this is not a real argument but just my personal opinion.
b) struts-form is not for XHTML
The tags are used to (and intended to) generate HTML, not XHTML or XML.
The reason to add the forbidden closing tag was - if I remember correctly -
to be able to use the generated document as input for XSLT. While I would
too like the ability to use Struts to generate output in different markup
languages (like XHTML1.0, WML or ....), it seems obvious, that each
markup language has it's own feature set and the approach to use a single
tag library for each and any markup language is doomed to fail.
A better approach IMHO would be to have different (form-)taglibs (one for
each markup language) and to switch between them with the taglib-directive.
c) (just) changing input would be "patchwork"
This is not the only occurrence where HTML differs from XHTML in a way that
prevents XSLT. What's about minimized boolean attributes (like selected,
checked, disabled and so on...). Struts generates them in their minimized
form, also being invalid XHTML. So, if it has to be done and I'm the only
one seeing problems with this kind of changes, it should be done _right_,
i.e. all occurrence should be properly changed and it should be documented,
that the form taglib is intended to generated XHTML (or HTML _and_ XHTML).
Comments ?
--
Matthias (mailto:make@BESToffers.de)
Re: Re[2]: Input tag and xml
Posted by bram <br...@info.nl>.
> I can't believe what I read ?! Why would one let Structs get even more
> incompatible to the HTML spec ?
>
> "Luckily" all variants break Netscape 4.7x. (No input tag at all :)
dunno what ns browser you used, but it works fine here, (maybe forgot the
"form" tags?)
Bram Meijboom
ps i used ns 4.76
Re[2]: Input tag and xml
Posted by Matthias Kerkhoff <ma...@BESToffers.de>.
> What happens to an ordinary browser when it sees an input tag with the closing
> "/" character as you suggest? If it works in every single case, I'm inclined to
> agree with you.
I can't believe what I read ?! Why would one let Structs get even more
incompatible to the HTML spec ?
"Luckily" all variants break Netscape 4.7x. (No input tag at all :)
--
Matthias (mailto:make@BESToffers.de)
Re: Input tag and xml
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
bram wrote:
> Hi, I have noticed the following, when I make a form using struts, with radio,
> checkbox and hidden fields,and later on do an xsl transformation over the
> "xhtml" the xhtml is invalid. the <form:hidden> and other Basefieldtagsare
> rendered as <input type="xxx"> > (without the / ) is there a reason that it is
> not rendered as <input type="xxx"/> (with the / )or <input
> type="xxx"></input> so I can "transform" it lateron? Thanx Bram Meijboom
What happens to an ordinary browser when it sees an input tag with the closing
"/" character as you suggest? If it works in every single case, I'm inclined to
agree with you.
Craig
Re: Input tag and xml
Posted by Matthias Kerkhoff <ma...@BESToffers.de>.
> is there a reason that it is not rendered as <input type="xxx"/> (with the / )
> or <input type="xxx"></input> so I can "transform" it lateron?
The HTML4 spec. disallows a closing tag for <input>. So, both <input ... />
and <input></input> would be invalid (for html4). Probably <input / >
would be ok - I remember it was mentioned somewhere in the xhtml spec. - but
I'm not sure, if non-xhtml-browsers could really handle it.
Matthias (mailto:make@BESToffers.de)