aspose file tools*
The moose likes JSP and the fly likes XML tagfile with dynamic attributes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "XML tagfile with dynamic attributes" Watch "XML tagfile with dynamic attributes" New topic
Author

XML tagfile with dynamic attributes

Taras Tielkes
Greenhorn

Joined: Nov 14, 2005
Posts: 6
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

Joined: Jan 10, 2002
Posts: 61658
    
  67

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18909
    
    8

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

Joined: Jan 10, 2002
Posts: 61658
    
  67

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

Joined: Nov 14, 2005
Posts: 6
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
 
subject: XML tagfile with dynamic attributes