logo       

Re: Extention elements: msg#00007

Subject: Re: Extention elements
I don't know if this is where you want to be heading but if you define a xsl:variable to be the Java object you are interested in. then create an extension element where you look for an attribute where the value of the attribute is the name of the xsl variable.

Once you have the name, you can fetch its value from the expression context with this code from an extension element

XObject value = (XObject) context.getTransformer().getXPathContext().getVarStack().getVariableOrParam()
I think, haven't actually used it.

or from an extension function, as I do in the SQL code, org.apache.xalan.lib.sql.SQLQueryProcessor.java XObject value = (XObject)ctx.getVariableOrParam(new QName(parm.getName()));

-JG


Joseph Shraibman wrote:



John Gentilin wrote:

Joe,
Are you trying to write an extension element or an extension function.

I figured out the function, not the element.

Extension Elements:
If you look at the source code for the Redirect extension, it is short and to the point piece of code to see how extensions work. With Extension Functions, I don't think you
can pass in objects although that may be incorrect.


You can, though it is a bit non-intuitive.

You do:
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        xmlns:java="http://xml.apache.org/xslt/java";
        exclude-result-prefixes="java"
        version="1.0">

... then

<xsl:param name="myparam"  />

... then <xsl:value-of select="java:methodname($myparam, $othervar)" />

Go to http://xml.apache.org/xalan-j/extensions.html#java-namespace and scroll down to the example.

<xsl:value-of select="java:format($formatter, $date)"/> does the same thing, where format is the method name and $formatter is the stf that format() is called on.

But what I really want to figure out is how do have the extention element operate on a passed in java object.



--
--------------------------------------
John Gentilin
Eye Catching Solutions Inc.
18314 Carlwyn Drive
Castro Valley CA 94546

   Contact Info
gentijo@xxxxxxxxxxxxxxx
Ca Office 1-510-881-4821
NJ Office 1-732-422-4917





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe