Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 9th, 2006, 02:39 PM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Read xpath query from node value

I would like to populate a drop list with options from an XML doc. However each option has disply/no-display conditions.

How can I execute the xpath query contained in the doc and check the true/false result condition?

ie(
 <optionNodeRoot>
    <option>
        <value>blah1</value>
        <show>../../stepID = 1</show>
    </option>
    <option>
        <value>blah2</value>
        <show>../../stepID = 2</show>
    </option>
    <option>
        <value>blah3</value>
        <show>../../stepID = 3</show>
    </option>
</optionNodeRoot>
 
Old January 9th, 2006, 04:20 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

There's no standard way of doing dynamic XPath evaluation in XSLT (1.0 or 2.0). A number of products have an extension function, usually called xx:evaluate(). Saxon also has saxon:evaluate-node() which is designed specifically for the use case where the XPath expression is within a source document and relative to the node it is contained in. Alaternatively, call out to a selectSingleNode() or similar method in JavaScript.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 11th, 2006, 06:50 PM
Registered User
 
Join Date: Jan 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great, thanks for the reply. I'll look up usage of the evaluate() function available in InfoPath 2003






Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath to get next node (sibling) jeft0nes XSLT 2 August 8th, 2007 08:30 PM
XML: How to select a node with ' in it using Xpath guozai BOOK: Professional C#, 2nd and 3rd Editions 1 October 6th, 2006 12:37 PM
XPath node selection nkuar XML 1 March 4th, 2006 09:40 PM
Access Namespace Node using XPath pvasudevan XSLT 1 January 2nd, 2006 06:20 AM
xpath: position parent of current node orion83 XSLT 1 September 5th, 2005 07:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.