Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 15th, 2006, 08:25 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default get value, not the path...

Hi,

New to the world of xslt, and working my way through my first project. 99% there, but I'm having a problem trying to compare two nodes. The $expectedValue variable winds up with the path's location, not with the value of the node at the path's location. How do I accomplish what I'm looking to do?

        <xsl:variable name="myTag" select="name()" />
        <xsl:variable name="uniqueAncestor" select="Step_1_DummyInfo" />
        <xsl:variable name="thisValue" select="." />
        <xsl:variable name="partPath1" select = "concat('../../../../../ExpectedHeader/',$uniqueAncestor)" />
        <xsl:variable name="partPath2" select = "concat($partPath1,'//')" />
        <xsl:variable name="expectedPath" select = "concat($partPath2,$myTag)" />

        <xsl:variable name="expectedValue" select="$expectedPath" />

        <!-- having trouble - the $expectedValue variable contains the STRING, not the Value, how do I get it to pull
             the VALUE so I can test it as follows: -->

            <xsl:choose>
               <xsl:when test="$expectedValue = $thisValue">


Thanks!
__________________
Thanks!
Reply With Quote
  #2 (permalink)  
Old June 15th, 2006, 08:41 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

XSLT doesn't allow an XPath expression to be constructed on-the-fly as a character string, it has to be written literally in the select attribute. Some products (such as Saxon) have an extension function (e.g. saxon:evaluate()) that will allow you to do this.

But I suspect that in your case you can achieve what you want with something like

select="../../../../../ExpectedHeader/*[name()=$uniqueAncestor]//*[name()=$myTag]"

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old June 15th, 2006, 08:58 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Michael. That was exactly it, and I spent hours on it before I came here (lesson learned).



Thanks!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with path for loading Pics (app.path) Tabbasum Beginning VB 6 2 November 15th, 2007 04:57 AM
Implementing the all-path shortest path problem bitwords XSLT 1 December 6th, 2006 11:37 AM
using app.path in database path and filename kd8con VB Databases Basics 2 October 25th, 2006 11:45 AM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
Path cavaleiro4 C++ Programming 0 September 15th, 2004 04:56 PM



All times are GMT -4. The time now is 06:31 AM.


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