|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How can i access a JSP function in XSL?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday 01 May 2002 02:18, Suman.Sathyanarayan@xxxxxxxxxxxx wrote:
> <% getTelephoneNumber(" %>
> <xsl:value-of select="value"></xsl:value-of>
> <% "); %>
When the JSP is executed and when the XSLT is executed are *totally*
different. You can't use a value returned from the XSLT while the JSP is
running, because the JSP *outputs* the XSLT -- which means the XSLT is
executed after the JSP.
What you have here will essentially be the same as:
<% getTelephoneNumber("\n <xsl:value-of select=\"value\"/> \n"); %>
which is probably not what you want. You will have to do one of three things:
* If you are making an HTML page, then you will have to do something like this
in your XSLT:
<input type="hidden" name="phone" value="{value}"/>
which uses an Attribute Value Template that will output the phone number into
the <input value="..."/>. You then have to put that into a <form> and make
the user click "submit" to return the value to the server where you can do
more processing -- pretty ugly.
* Check out the Cocoon project (http://xml.apache.org/cocoon), and convert all
of your .jsp files to .xsp. This is a totally new language, so converting
won't be easy, but it *might* be able to do what you want (emphasis on
*might*, since you still won't be able to use XSLT directly in the page)
* Use your processor's extension mechanism to be able to access
getPhoneNumber() in the XSLT, so you can do something like:
<xsl:value-of select="xx:getPhoneNumber(value)"/>
This is probably the best way to go, but it depends on a lot of other factors
such as the processor, where getPhoneNumber is defined, and whether
getPhoneNumber relies on non-static state that is innaccessible from where it
is called by the extension.
- --
Peter Davis
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8z8MmNSZCJx7tYycRAjQaAJwPZ1PqA9/TCJO9tD5NMx3vbUXmjgCg2FBb
dK5TjUQxzYXZRjHT1XhYhwU=
=wB5K
-----END PGP SIGNATURE-----
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








