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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:17:10+00:00 2026-05-15T21:17:10+00:00

For the below xml i want to render the unescaped text parts on browser

  • 0

For the below xml i want to render the unescaped text parts on browser from xslt e.g.:

<one>
&lt;text&gt;
</one>

I want the markup rendered on browser to be:

&lt;text&gt;

But when I use the apply templates which looks like below

<xsl:template match="text()" mode="literalHTML">
    <xsl:copy-of select=".">
    </xsl:copy-of>
</xsl:template>

The above XML is getting rendered as:

<text>

How can I modify this template so that it prints &lt;text&gt; on browser?

Best Regards,
Keshav

  • 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-15T21:17:11+00:00Added an answer on May 15, 2026 at 9:17 pm

    This can be achieved in XSLT 1.0 using quite tricky recursive processing.

    Fortunately, one can use FXSL ( a library of XSLT templates) to solve the same task in just a few minutes:

    <xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:f="http://fxsl.sf.net/"
    xmlns:testmap="testmap"
    exclude-result-prefixes="xsl f testmap">
       <xsl:import href="str-dvc-map.xsl"/>
    
       <testmap:testmap/>
    
       <xsl:output omit-xml-declaration="yes" indent="yes"/>
    
       <xsl:template match="/">
         <xsl:variable name="vTestMap" select="document('')/*/testmap:*[1]"/>
         <xsl:call-template name="str-map">
           <xsl:with-param name="pFun" select="$vTestMap"/>
           <xsl:with-param name="pStr" select="/*/text()"/>
         </xsl:call-template>
       </xsl:template>
    
        <xsl:template name="escape" mode="f:FXSL"
         match="*[namespace-uri() = 'testmap']">
          <xsl:param name="arg1"/>
    
          <xsl:choose>
           <xsl:when test="$arg1 = '&lt;'">&amp;lt;</xsl:when>
           <xsl:when test="$arg1 = '&gt;'">&amp;gt;</xsl:when>
           <xsl:otherwise><xsl:value-of select="$arg1"/></xsl:otherwise>
          </xsl:choose>
        </xsl:template>
    
    </xsl:stylesheet>
    

    when this transformation is applied on the following XML document:

    <one>
    &lt;text&gt;
    </one>
    

    the wanted result is produced:

    &amp;lt;text&amp;gt;
    

    and it displays in the browser as: &lt;text&gt;

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

Sidebar

Related Questions

I want to save data from a xml file to my database, and below
I want to read all XML contents from a file. The code below only
I have a listView with custom objects defined by the xml-layout below. I want
I want to create a XML file in csharp like the below format pls
I want to write a XML file as below: <?xml version=1.0 encoding=UTF-8?> <books xmlns:xsd=http://www.w3.org/2001/XMLSchema
I am using jQuery.ajax to read and render XML file into HTML. The below
I want to sort below xml, Based on the Adult and child ( i
want to query below xml <courseList filedUnder=Courses> <category code=4wd title=4wd Operation> <product code=lr title=4wd
I have below table structure ID int xmlData xml I want data in the
i want to insert iteration elements(Signal) according my requirement like below xml output. <?xml

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.