• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

xsl template question

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm trying to get familiar with XSL and got the following code from the web that replaces a string withing a string with a selected string. Ie. let's says I have [email protected] I would like to replace it with george_REMOVE_AT_mysite.com. So here is the template....




and here is how i try to access it. I can't seem to find the correct way to call it. I get Could not find function: replace-string. The code works if I just display text but it crashes when I try to use the replace-string template.



Thanks for any guidance.
 
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You call it in your main template in exactly the same way you called it recursively in itself:
 
Angelo Bonaparte
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That did the trick. I just gotta figure out how to display the result of calling that template. I tried a few ways already but without success.
 
Paul Clapham
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That depends on what you mean by "display". Normally an XSLT stylesheet produces a result (which can be XML or HTML or text). So by "display" do you mean you want the xsl:call-template element to include something in the result? It doesn't return a value itself, so whatever it is you want included in the result, the template has to do that.

But if you wrap that in an xsl:variable element, then that variable becomes the output destination for the time being.
[ April 04, 2007: Message edited by: Paul Clapham ]
 
Angelo Bonaparte
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response it's appreciated. Before I added a template to replace the @ to AT in an email address I had the following wich rendered the html to display Email Address: then the email address.

Here is the code:



Now with the code below my html renders, no errors occur but I only get the label, the actual email with the @ removed doesn't show. Here is the code.
Again, thanks for all your help.
 
Paul Clapham
Sheriff
Posts: 28346
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You passed the constant string "text" to the template. Based on what you posted earlier, I would expect to see that same string appearing in the output. (I do that all the time too.)
 
Angelo Bonaparte
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I will try again but so far I only get the label Contact Email:
but the email address doesn't appear. I will try different things to see what happens.
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic