Hi Michael

From: "Michael McKibben" <[EMAIL PROTECTED]>
> Hello, I've been experimenting with the org.dom4j.rule.* package and was
> wondering if there were plans to add support for named template rules and
> adding a callTemplate(String name) method to the Stylesheet class?
>
> Currently I extend Rule and Stylesheet to add this behavior, but if others
> could see a use for it, then I could work on a patch for Rule and
> Stylesheet.

That'd be great!

Actually I spotted this missing feature recently when implementing 'Jelly
Stylesheet Language', JSL...

http://jakarta.apache.org/commons/sandbox/jelly/


> Also, I think the Action interface is somewhat deficient in that it has no
> way to get a reference to the associated Stylesheet. Actions might need
> their Stylsheet so that they can call applyTemplates(...). This is
> equiv. to the following xsl:
>
> <template match="/">
> <apply-templates select="myelement"/>
> </template>
>
> would become the following Rule/Action:
>
> new Rule(DocumentHelper.createPattern("/"), new Action() {
> run(Stylesheet stylesheet, Node contextNode) {
>     stylesheet.applyTemplates(contextNode, "myelement");
> }
> }
> );
>
> Or am I missing something about how to implement an Action?

Agreed. Though an Action might need all kinds of extra information. You can
always implement your own Action class that has whatever properties you
wish. Also you can use anonymous inner classes...

final Stylesheet stylesheet = ...;
Action action = new Action() {
    public void run(Node node) {
        stylesheet.applyTemplates(node, "myelement");
    }
};


Would that do?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to