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 241211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:44:04+00:00 2026-05-11T20:44:04+00:00

I am using XSL to display an XML representation of an email message in

  • 0

I am using XSL to display an XML representation of an email message in browsers. Email attachments are stored in separate files to the main email XML file, and so I want the resulting web page for the email to contain a link to its attachments.

However some of the attachments are email messages themselves, and may have been forwards or replies and thus may have names containing colons like FW:Important. The name is URL-escaped as FW%3AImportant, and stored as a file as FW%3AImportant.xml.

The problem is that the URL in my XSL-produced web page is unescaped and once again contains the colon (file://FW:Important.xml) and thus is a broken link. What is the best way to stop this behaviour?

Here is the XML snippet:

<email:part email:filename="FW%3AImportant">
    <email:attachment filename="FW%3AImportant.xml">
        FW%3AImportant.xml
    </email:attachment>
</email:part>

And here is the XSL snippet:

<xsl:template match="email:email/email:parts">
    <xsl:for-each select="email:part/email:attachment">
        <a>
            <xsl:attribute name="href">
                <xsl:value-of select="@filename" />
            </xsl:attribute>
            <xsl:value-of select="@filename" />
        </a>
    </xsl:for-each>             
</xsl:template>
  • 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-11T20:44:04+00:00Added an answer on May 11, 2026 at 8:44 pm

    I think you are on the wrong track here. It is not XSLT that unescapes your URL, it is the browser.

    The only escape sequences known to XML (and hence to XSLT) are in the form of “&xxx;“. The “%xx” of your URL strings is left unchanged.

    The problem is that your <a href="..."> contains exactly the string the browser is trying it with. So you are doing something wrong when encoding the URL.

    When the file on the file-system is stored as:

    FW%3AImportant.xml

    then the correct URL to reference it must be:

    <a href="FW%253AImportant.xml">FW%3AImportant.xml</a>
    <!-- ------^^^ the '%' char itself must be escaped! -->
    

    This means you have to URL-encode the string before you place it in a href attribute, just like in any other system that generates HTML.

    Unfortunately, there is no native URL-encode function in XSLT. This means you can either use an extension function of your XSLT environment, or do the encoding in a separate template using XPath string functions. Since correct URL-encoding is not exactly trivial, I recommend using something proven here. Here is a stylesheet you can reference (<xsl:import>) that does it for you: http://skew.org/xml/stylesheets/url-encode/

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

Sidebar

Related Questions

I'm using xslt do display Solr response in html, my xsl file is in
How can I retrieve the XML source file name using XSL 1.0 code?
I have an xml resultset which has to be converted using XSL for display
I am trying to modify a proprietory XML file using XSL and MSXSL. The
I used the below code to display a XML file as HTML using XSLT
I'm using Xsl transformation to display an Xml data as Html. <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform
I'm using the following javascript code to display xml/xsl: function loadXMLDoc(fname) { var xmlDoc;
I have an XML file that I am using XSL to convert into an
I want help in getting a value from one xml into another using xsl,
we're currently generating all our official documents using XSL-FO transformation using .xml files as

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.