Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML tagfile with dynamic attributes

 
Taras Tielkes
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a couple of tagfiles that generate form elements with specific conventions for the 'name' and 'value' attribute. Basically, a data binding framework.

Dynamic attributes are useful because you can delegate all the usual html attributes the the generated HTML form element: SELECT, INPUT etc.

The usual way to do this is to concatenate all the "pass-through" attributes to a spring, and append this string to the element generated:


I'm wondering how to do this in a tagfile in XML format (mytag.tagx), since the XML format forbids something like the example above.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Pakka Pakka",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Paul Clapham
Sheriff
Pie
Posts: 20188
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that XSLT includes an <xsl:attribute-set> element where you can predefine a set of attributes (e.g. 'name' and 'value'), plus a 'use-attribute-sets' attribute on the <xsl:element> element where you can add those attributes to a particular element.

Now if you could just work an XSL transformation step into your processing at the right time, this might be the basis of a solution.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you using the XML format? As you have seen it's rather restrictive and not intended for pages/tags that are hand-coded.
 
Taras Tielkes
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are using the XML format to facilitate some automatic processing and inspection of the JSP pages.

It seems to me that the lack of a way to use dynamic attributes in XML tag files is a serious flaw of the JSP 2.0 specification.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic