Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6026463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:26:56+00:00 2026-05-23T04:26:56+00:00

First I have to state that I touched XSLT today for the first time

  • 0

First I have to state that I touched XSLT today for the first time because a friend asked me for help.

We’re trying to generate a link for GMaps. Everything works as long as there is no space in the variable we’re using. Here’s the code.

<xslt:template name="buildmaps">
    <xslt:param name="linkstart"/>
    <xslt:param name="link_target_street"/>
    <xslt:param name="link_target_postalcode"/>
    <xslt:param name="link_target_city"/>
    <xslt:param name="linktext"/>
    <xslt:param name="target"/>
        <xslt:text disable-output-escaping="yes">&lt;a href=http://maps.google.de/maps?hl=de&amp;saddr=Hauptstr.%2057%2044789%20Bochum</xslt:text>
        <xslt:text disable-output-escaping="yes">&amp;daddr=</xslt:text>
        <xslt:value-of select="$link_target_street"/>
        <xslt:text disable-output-escaping="yes">%20</xslt:text>
        <xslt:value-of select="$link_target_postalcode"/>
        <xslt:text disable-output-escaping="yes">%20</xslt:text>
        <xslt:value-of select="$link_target_city"/>         
        <xslt:text disable-output-escaping="yes">" target="</xslt:text>
        <xslt:value-of select="$target"/>
        <xslt:text disable-output-escaping="yes">"&gt;</xslt:text>
        <xslt:value-of select="$linktext"/>
        <xslt:text disable-output-escaping="yes">&lt;/a&gt;</xslt:text>
</xslt:template>

The problem occurs with the $link_target_street variable. Which looks like “Bahnhofstr. 9”. We get our link allright like “http://maps.google.de/…daddr=Hauptstr.&#8221;. So everything stops at the blank between Hauptstr. and 9.

Is there something I can do about it?

Thx in advance.

Update:

Now I know I’m using XSLT 1.0. So no replace for me 🙁

Now a bit about the output:

It should look like this:

<a href="http://maps.google.de/maps?hl=de&amp;saddr=Hauptstr.%2057%2044789%20Bochum&amp;daddr=Mainstreet%2023%2012345%20Bochum" target="_blank">

The problem lies in the street name. There I get:

... &amp;daddr=Mainstreet 23%2012345%20Bochum" ...

but I need

... &amp;daddr=Mainstreet%2023%2012345%20Bochum" ...

At this point I’m not sure if XSLT really stops at this blank or if the Url is just too broken to get handled properly. Either way if I could change the blank to ‘%20’ everything would be fine. I think probably the links from Tomalak will help me out.

Unfortunately I’m at home now and have to set up a test environment myself but we found the debug option so I hope that will fasten the process.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:26:56+00:00Added an answer on May 23, 2026 at 4:26 am

    Looks like you are shooting yourself in the foot.

    <xslt:template name="buildmaps">
        <xslt:param name="linkstart"/>
        <xslt:param name="link_target_street"/>
        <xslt:param name="link_target_postalcode"/>
        <xslt:param name="link_target_city"/>
        <xslt:param name="linktext"/>
        <xslt:param name="target"/>
        <a href="http://maps.google.de/maps?hl=de&amp;saddr=Hauptstr.%2057%2044789%20Bochum&amp;daddr={$link_target_street}%20{$link_target_postalcode}%20{$link_target_city}" target="{$target}">
            <xslt:value-of select="$linktext"/>
        </a>
    </xslt:template> 
    

    Note that there are Attribute Value Templates.

    Further, XSLT has no built-in function to do URL-encoding. However, that is what you need to do when you want to place arbitrary values into a URL.

    There are a few methods to make a URL-encoding function available to XSLT, it depends on your XSLT processor which one would work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, i have to state that i am new to Java in
I have a form I'm trying to do validation on. Requirements state that underscore
First I want to state that I asked a similar question before, however I
First I have a PHP file that gets data and file from a HTML
A database connection on Oracle can have session state that persists for the lifetime
First of all, I must state that I'm a complete newb when it comes
First let me just state that coding without unit testing is just plain crazy.
Does anyone have any idea why Apple designed UIGestureRecognizer the way that default state
First and foremost let me state that I know that accessing server side controls
First of all I would like to state that I am a beginner at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.