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 July 17th, 2007, 06:20 AM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default modifying a node in xslt

Hi all,

Would it be possible to gain a little guidance on this problem i have.

Basically i have a node that contains a URL. I basically want to modify the URL so it automatically adds two further strings. for example user types in www.google.com. Then i want the xslt to add strings onto it automatically, like /search for example. resulting in the URL to be www.google.com/search?

can anyone help?

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old July 17th, 2007, 07:25 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

I can't see why you're finding this difficult. You just need something like

<xsl:template match="url">
  <xsl:value-of select="concat(.,'/search')"/>
</xsl:template>

Mind you, building URLs by concatenating strings has many pitfalls if you're going to make it robust.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old July 17th, 2007, 08:25 AM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Would it be more difficult like this;

www.google.com/images/image.jpg

*i want to change it through xslt by doing this

www.google.com/images/_t/image_jpg.jpg?

i basically want to add a subdomain to the route and a simple extention to the name of the image file?

its all because of thumb nails you see

could you please help on this final stage of my project?

many thanks again

Reply With Quote
  #4 (permalink)  
Old July 17th, 2007, 09:15 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 1.0 provides a fairly limited range of operators for string manipulation: concat(), substring(), substring-before(), and a few others. But you can do surprisingly complex things if you learn how to write recursive templates. XSLT 2.0 has a much richer repertoire including full regular expressions - matches(), tokenize(), and replace().

If you have a specific problem achieving a specific transformation with these functions then I can help you. However, you must first specify the problem precisely, and you then need to make your best efforts to solve it for yourself. I'm not going to write the code for you.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
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
XSLT Help to get value from Upper Node by compare pixelheart XSLT 10 May 1st, 2008 12:25 PM
changing output for one node in XSLT shane_carty XSLT 3 February 27th, 2008 05:28 AM
XSLT Going up a level from current node. lafilip XSLT 4 February 23rd, 2007 03:06 PM
Problem regarding finding the node in xslt. rohitjain13 XSLT 1 October 6th, 2005 03:26 AM
Modifying time with XSLT bigdog-yahoo XSLT 3 March 30th, 2005 11:56 AM



All times are GMT -4. The time now is 04:47 AM.


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