xsl-list
[Top] [All Lists]

Re: [xsl] Passing XML Tree to a java method as String.

2006-07-14 11:41:55
I just wanted to mentioned, that I have tried the technique below with
Saxon, and it worked all right. Other processors like Xalan-J might be
using a different convention.

Regards,
Mukul

On 7/14/06, Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
Hi Omar,
 Please try something like this:

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:String="http://www.sun.com/java.lang.String";>

<xsl:template match="/">
  <xsl:variable name="myxml">
     <xsl:copy-of select="env:Envelope/env:Body/*" />
  </xsl:variable>
  <xsl:value-of select="JavaClassRef:javaMethod(String:toString($myxml))" />
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

On 7/14/06, Omar Saeed <omar(_dot_)saeed(_dot_)email(_at_)gmail(_dot_)com> 
wrote:
> Hi,
>
> I have a SOAP Message in the XSL template and need to pass everything
> inside the Body element to a java method that takes a String.
>
> When I do the following:
> <xsl:template match="/">
>        <xsl:variable name="myxml">
>                <xsl:copy-of select="env:Envelope/env:Body/*" />
>        </xsl:variable>
>
>        <xsl:value-of select="JavaClassRef:javaMethod($myxml)" />
> </xsl:template>
>
> In the javaMethod I get only the values inside the elements passed.
> How can I pass everything including the elements that are inside the
> Body element as String (the entire XML structure as String)? Do I need
> to convert the XML to String?
> Or is it more a question of deserializing the XML ? How do I do this,
> are there any libraries that provide this?
>
> Any help much appreciated.
> Omar

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--