Hi Ajay,
    Let's assume your variable "v1" would finally have a value in it (based
on some selection logic that you want to write, which essentially extracts
data from your input XML document), as below,

<xsl:variable name="v1" select="'SendRequest'"/>   <!-- or can have value
'ExchangeRequest' -->

(I've directly written the value for this variable, but in your case the
value would be computed as you wrote)

You now essentially want to copy a node to output XSLT tree as below,

<xsl:copy-of select="$v1/Request/RequestHeader"/>

Of course this would not work, since 'v1' here is not a node and is a
string value.

But I think, the following would probably work,

<xsl:copy-of select="*[local-name() = $v1]/Request/RequestHeader"/>

Or perhaps something like below would also work (which is closer to what
you're asking i.e text to a node),

<xsl:element name="{$v1}">
     <xsl:copy-of select="*/Request/RequestHeader"/>
</xsl:element>

Does any of above approaches suites you better?

On Sat, Nov 19, 2011 at 10:12 PM, ajay bhadauria <abhadau...@yahoo.com>wrote:

> Hi Mukul,
>
> Thanks a lot for reply.
>
> The solution you gave will work. But in my xml file, the root element of
> document could  SendRequest or ExchangeRequest. So I was thinking that I
> could define a variable and based upon the value of  this variable (
> SendRequest or ExchangeRequest) I can copy all the elements.
>
> Sorry about that I have not mentioned in my last query.
>
> So , if there anything is anything in the XSL which I can use it and
> convert text to node.
>
>
> Regards
> Ajay
>





-- 
Regards,
Mukul Gandhi

Reply via email to