Skip to Content
author's profile photo Former Member
Former Member

XSL calls Java

Hello,

has some tried to call from an XSL-Stylesheet to render XML-Files an Java-Class? Can i use <xsl:script>?

regards,

Marco

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Feb 02, 2005 at 12:31 PM

    Hi Marco,

    You didn't give a lot of info to go on in your question,

    so I will try to answer it making some assumptions

    concerning what you may be trying to do.

    KMC uses server-side XSL in a few places such as

    notifications and XML Forms. The part that transforms

    the XML and XSL to the output (usually HTML) is the

    XSL processor. KMC uses a SAP-proprietary XSL processor

    for this. This processor is compatible with the Java API

    for XML Processing as described by Sun. This processor

    is NOT 1-to-1 compatible to any of the various XSL

    processor versions from Microsoft. Microsoft made a lot

    of their own extensions to their processors, one of which

    is allowing JavaScript. This is quite powerful when

    used on the client side since the whole IE DOM is

    accessible. As that SAP supports more than just

    MS platforms, we tend to avoid such platform-specific

    dependencies. For our server-side services, we use

    "standard" XSL and would recommend avoiding extensions

    for which support may vary depending on the processor

    implementation. I know from personal experience that

    implementing logic using Xpath can be painful and takes

    getting used to, but once you get the hang of it, it

    is quite powerful, efficient, and portable.

    Naturally, you could also write your own content which

    uses client-side transforms. This should be transparent

    to KMC, but you may have problems ensuring that an

    appropriate processor is on the client machine.

    Additionally, when customizing server-side XSL, it is

    sometimes worthwhile creating a client-side test environment

    to tighten up the development cycle. One of the big

    gotchas here though, is that you have to be real careful

    not to change the character encoding on the server-side

    version. It is easy to overlook that this gets broken, since

    you may first see it when using special characters in

    other languages.

    I wrote a post some time ago concerning customizing

    notifications. Some of this info is dated now, but there

    are still some interesting parts.

    customized-subscription-massage

    BTW: We're talking about "messages" here - for "massages"

    I am not really the right person to answer!

    If you are trying to use an XSL:SCRIPT tag on the

    server side to call an arbitary Java class, I do not

    think that will work at all. Instead, consider alternate

    solutions where invoking services via URLs might help.

    You may also might get some client-side JavaScript to

    do the tricky part for you. On the XSL side, you

    would just treat this as mainly static text, possibly

    with some dynamic tidbits.

    One standard trick some people use on the web is to use

    IMG URLs (src attributes) to invoke functions returning

    a dummy 1x1 picture. You can formulate the URL with the

    XSL the way you want, and the client page will kick it.

    I am sure there are many such clever tricks that might

    help you solve your problem.

    This is not an endorsement, but I find the devguru com

    site, among others, are good references concerning these

    kinds of issues.

    Let me know if I addressed your issue.

    Regards,

    Darin Krasle

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.