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 September 19th, 2005, 08:14 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stripping down variable values

I was wondering if its possible to filter through a variable value. I'm setting up logic which will swap the class used on the navigation so that when your on each page, the selected pages navigation will visually represent it. Typically I would handle this in js but I want to do it in xsl. So, below I would like the value of everything past the /. I just need the word "when". Can I pull just that somehow?


<xsl:variable name="page" select="fcd/when" />

I'm sure there is a much better way to do this but here is my plan. I'd like to have a choose statement look to see if an active attribute setup in the xml file matches the value of page in the xsl. If so, use this css class, if not then use the regular (inactive) class. Any help would be greatly appreciated!

Thanks,
-m



Thanks!
-m

 
Old September 19th, 2005, 09:00 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

<xsl:variable name="page" select="fcd/when" />

Did you mean to write that: i.e. the select attribute is a path expression that selects the "when" child of the "fcd" child? If so, there's no way you can treat it as a string at run-time, the compiler will have turned it into something quite different by then.

If you actually meant that page is a string, viz

<xsl:variable name="page" select="'fcd/when'" />

then you can extract the "when" using substring-after($page, '/').




Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript variable values into ASP phungleon Classic ASP Basics 2 May 13th, 2004 02:10 PM
How to add two variable with Decimal values sa_moizatyahoo ASP.NET 1.0 and 1.1 Basics 1 April 3rd, 2004 06:17 AM
request values into variable from another form ? rehana Beginning PHP 5 December 16th, 2003 02:34 PM
how to get env variable values? suri Java Databases 1 September 20th, 2003 05:34 PM





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