[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Linking Variable to the Path

Subject: RE: Linking Variable to the Path
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 22 Aug 2007 22:58:42 +0100
RE:  Linking Variable to the Path
The basic answer is that standard XSLT does not allow you to construct an
XPath expression dynamically from a string. It's a common requirement and
several processors provide extensions (saxon:evaluate, dyn:evaluate) that
handle it - but some do not.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Yaswanth Kumar Ravella [mailto:yaswanth.mtrx@xxxxxxxxx] 
> Sent: 22 August 2007 09:16
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Linking Variable to the Path 
> 
> 
> Hi,
> 
> ::I am having an XML file like this ::
> 
> <root>
>  <every>
>    <event name="Ready"/>
>  </every>
>  <pattern>
>    <connection destination="//every[1]/event[1]" />		
>  </pattern>
> </root>
> -------------------------------
> ::When my XSL file has this code::
> 
> <xsl:template match="root">   
>    <xsl:variable name="dest" 	select="//every[1]/event[1]"/>   
>    <xsl:value-of select="$dest/@name"/>   
> </xsl:template>
> 
> It prints 'Ready'.
> Here I am directly assigning variable 'dest' to the path of the event.
> This is ok.
> -------------------------------
> ::When I changed my XSL code to ::
> 
> <xsl:template match="root">   
>    <xsl:variable name="dest"
> select="//pattern[1]/connection[1]/@destination"/>   
>    <xsl:value-of select="$dest/@name"/>   
> </xsl:template>
> 
> It doesn't print 'Ready' or anything.
> Here I am storing variable 'dest' with the value of the 
> 'connection/@destination', Which I expected to work properly 
> but it is not working.
> ------------------------------
> 
> How can I print 'event-name' using 'connection-destination'?
> 
> 
> Regards
> Yaswanth Ravella

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.