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

Re: How to apply a xpath value in one XML to access th

Subject: Re: How to apply a xpath value in one XML to access the relevant XML for binding the data in XSL
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 27 Jul 2011 19:26:29 +0100
Re:  How to apply a xpath value in one XML to access th
On 27/07/2011 18:31, Sanjaya Liyanage wrote:
Hi all,
    I want to access one XML which has a xpath of another XML where I
should bind data in XSL.

You need to look for an extension in your processor such as xx:eval() or xx:evaluate(), for example saxon:evaluate(), which allows you to evaluate a dynamically-obtained XPath expression.


Michael Kay
Saxonica
test.xml

<button>
<id>btn1</id>
<x>225</x>
<y>450</y>
<paths>document('a.xml')/catalog/title</paths>
</button>

a.xml

<catalog>
<title>History</title>
<year>1987</year>
<catalog>

My target XSL which produces output correctly

    <xsl:for-each select="button">
    <button id="{id}" type="button"
style="position:fixed;top:{y}px;left:{x}px;">
    <xsl:value-of select="document('a.xml')/catalog/title"/>
    </button>
    </xsl:for-each>

My current XSL which gives wrong output which is the path as the value
of the button


<xsl:for-each select="button"> <button id="{id}" type="button" style="position:fixed;top:{y}px;left:{x}px;"> <xsl:value-of select="path"/> </button> </xsl:for-each>

How can I achieve my target?Any ideas are welcome.Thank you.

Sanjaya Liyanage

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.