Custom Tags

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom Tags

Joseph Lawrence
Hi all,
 
 I like to know which is the best approach to create custom tags in Orbeon. For example,  I   want to use a custom tag like the following in our XForms View:
 
<stx:MyTag myid="249">TEST</stx:MyTag>
 
 I  would like these tags to be processed/parsed into XForms/XHTML expressions at runtime so that the Orbeon's XForms engine can do the rest of the work. We want these tags to be as flexible as possbile - for example, to call a Java handler for that tag at run time (similar to JSP tags). We also need the ability to access the data Model instance while we process these custom tags ( so that ,for example, we will be able to evaluate XPath expressions embedded inside our custom tags at runtime)
 
We had tried out a simple custom tag processor (our own) which would translate custom tags into XForms/XHTML at runtime. It seems to work.   But is this the best way?
 
Does Orbeon provide any built-in methods to define custom tags ?
 
I read something about JSP preprocessing for XForms. Can we define our custom tags as JSP tags which will be postprocessed by the Orbeon XForms engine? Will that approach have the required flexibility that I described above ?
 
Thanks in advance,
Joseph Lawrence
Stabilix Solutions


Never miss an email again!
Yahoo! Toolbar
alerts you the instant new Mail arrives. Check it out.

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Custom Tags

Alessandro Vernet
Administrator
Hi Joseph,

In general, you won't be able to have access XForms instances. This is
because instances exist when the XForms engine runs, but since you
code generates XForms it needs to run before the XForms engine runs.
This is in general not a major problem, because you can generate
XForms code which in turn has access to XForms instances. I see 3
options:

1. Creating your own tag lib and using JSP. You then either use the
filter or request forwarding to pass control to Orbeon Forms.

2. Use XSLT. The XForms controls example use elements like
<widget:tabs> and <widget:tab> to render the tabs. Those elements are
transformed into XForms with XSLT. You can see that XSLT code in
config/xforms-widgets.xsl. You could add the implementation for your
own elements to this XSLT file. You can also write your own XSLT file
and call it from config/epilogue.xpl (before xforms-epilogue.xpl).

3. If you prefer to write Java code, you can also implement your own
processor. You would hook up that processor in config/epilogue.xpl.

#2 is my favorite. If a lot of code needs to run to implement those
tags, then #3 is maybe a better option. Unless you have other reasons
to use JSP, #1 seems to make things more complex than they need to be
by adding this extra layer of JSP processing, and
filtering/forwarding.

I hope this helps,

Alex

On 2/4/07, Joseph Lawrence <[hidden email]> wrote:

> Hi all,
>
>  I like to know which is the best approach to create custom tags in Orbeon.
> For example,  I   want to use a custom tag like the following in our XForms
> View:
>
> <stx:MyTag myid="249">TEST</stx:MyTag>
>
>  I  would like these tags to be processed/parsed into XForms/XHTML
> expressions at runtime so that the Orbeon's XForms engine can do the rest of
> the work. We want these tags to be as flexible as possbile - for example, to
> call a Java handler for that tag at run time (similar to JSP tags). We also
> need the ability to access the data Model instance while we process these
> custom tags ( so that ,for example, we will be able to evaluate XPath
> expressions embedded inside our custom tags at runtime)
>
> We had tried out a simple custom tag processor (our own) which would
> translate custom tags into XForms/XHTML at runtime. It seems to work.   But
> is this the best way?
>
> Does Orbeon provide any built-in methods to define custom tags ?
>
> I read something about JSP preprocessing for XForms. Can we define our
> custom tags as JSP tags which will be postprocessed by the Orbeon XForms
> engine? Will that approach have the required flexibility that I described
> above ?
>
> Thanks in advance,
> Joseph Lawrence
> Stabilix Solutions
>
>  ________________________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>

--
Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Custom Tags

Joseph Lawrence
Hi Alex,
      Thank you very much for your support.
 
Thanks
Joseph Lawrence
Stabilix Solutions

Alessandro Vernet <[hidden email]> wrote:
Hi Joseph,

In general, you won't be able to have access XForms instances. This is
because instances exist when the XForms engine runs, but since you
code generates XForms it needs to run before the XForms engine runs.
This is in general not a major problem, because you can generate
XForms code which in turn has access to XForms instances. I see 3
options:

1. Creating your own tag lib and using JSP. You then either use the
filter or request forwarding to pass control to Orbeon Forms.

2. Use XSLT. The XForms controls example use elements like
and to render the tabs. Those elements are
transformed into XForms with XSLT. You can see that XSLT code in
config/xforms-widgets.xsl. You could add the implementation for your
own elements to this XSLT file. You can also write your own XSLT file
and call it from config/epilogue.xpl (before xforms-epilogue.xpl).

3. If you prefer to write Java code, you can also implement your own
processor. You would hook up that processor in config/epilogue.xpl.

#2 is my favorite. If a lot of code needs to run to implement those
tags, then #3 is maybe a better option. Unless you have other reasons
to use JSP, #1 seems to make things more complex than they need to be
by adding this extra layer of JSP processing, and
filtering/forwarding.

I hope this helps,

Alex

On 2/4/07, Joseph Lawrence wrote:

> Hi all,
>
> I like to know which is the best approach to create custom tags in Orbeon.
> For example, I want to use a custom tag like the following in our XForms
> View:
>
> TEST
>
> I would like these tags to be processed/parsed into XForms/XHTML
> expressions at runtime so that the Orbeon's XForms engine can do the rest of
> the work. We want these tags to be as flexible as possbile - for example, to
> call a Java handler for that tag at run time (similar to JSP tags). We also
> need the ability to access the data Model instance while we process these
> custom tags ( so that ,for example, we will be able to evaluate XPath
> expressions embedded inside our custom tags at runtime)
>
> We had tried out a simple custom tag processor (our own) which would
> translate custom tags into XForms/XHTML at runtime. It seems to work. But
> is this the best way?
>
> Does Orbeon provide any built-in methods to define custom tags ?
>
> I read something about JSP preprocessing for XForms. Can we define our
> custom tags as JSP tags which will be postprocessed by the Orbeon XForms
> engine? Will that approach have the required flexibility that I described
> above ?
>
> Thanks in advance,
> Joseph Lawrence
> Stabilix Solutions
>
> ________________________________
> Never miss an email again!
> Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>


--
Orbeon Forms - Web Forms for the Enterprise, Done the Right Way
http://www.orbeon.com/


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws