Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] How can i access a JSP function in XSL?

From: Peter Davis <pdavis152@--------->
To:
Date: 5/1/2002 2:22:00 AM
-----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


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent