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 October 14th, 2004, 10:21 AM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Turning element text into XPath

I would like to take the value of an element and use it as an XPath. For example:

XML
<some_xpath>/colors/blues/@name</some_xpath>

XSL
<xsl:value-of select="some_xpath"/>

(I would like the output to be the nodes of /colors/blues/@name, not the string)

I suppose I could somehow split apart the the string and find each node, but I was hoping there was an easier way.

(assume /colors/blues/@name is XML somewhere else)



Thanks,

Kael
 
Old October 14th, 2004, 11:07 AM
Authorized User
 
Join Date: Jul 2004
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Kael,

The only way around this (unless you are using xslt 2.0) is to use an extended function (processor dependant):

See my reply in the following thread:
http://p2p.wrox.com/topic.asp?TOPIC_ID=20364

Regards
Bryan




 
Old October 14th, 2004, 11:18 AM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, I'll see what I can do with an extended function, or maybe I'll look into using XSLT 2.0..

Thanks,

Kael
 
Old October 14th, 2004, 03:28 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I'm fairly confident that even XSLT 2 doesn't do this.
The extension function or a two phase transform is the way to go.



--

Joe (Co-author Beginning XML, 3rd edition)
 
Old October 14th, 2004, 03:31 PM
Registered User
 
Join Date: Oct 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've implemented the extended function.. works like a charm. Thank you.



Thanks,

Kael
 
Old October 14th, 2004, 03:37 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Which XSLT processor are you using?

--

Joe (Co-author Beginning XML, 3rd edition)





Similar Threads
Thread Thread Starter Forum Replies Last Post
substitute text() node value in XPath expression Coolcampers XSLT 4 April 30th, 2008 08:39 AM
positioning text + form element + firefox Adam H-W CSS Cascading Style Sheets 2 June 12th, 2007 03:18 AM
Isolating element text EstherMStrom XSLT 6 September 17th, 2004 01:15 PM
Getting HTML element text using id badgolfer Javascript How-To 1 July 27th, 2004 12:17 PM
xpath not picking up first element darrenclump XSLT 7 October 13th, 2003 11:36 PM





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