javascript - Render escaped XML on browser -


For the XML given below, I want to present the undefined text parts on the browser with XSLT eg:

< Pre> & lt; One & gt; & Amp; Lt; In the text & amp; Gt; & Lt; / A & gt;

I should have a markup sung on the browser:

  & amp; Lt; Text & gt;  

But when I apply a template that looks like the bottom

   

The above XML is being provided as:

  & lt; Text & gt;  

How do I modify this template so that it can print & amp; the lift; Text & amp; Gt; On the browser?

Best regards, Keshav

It can be found in XSLT 1.0 Using hard iterative processing.

Fortunately, anyone can use the (Library of XSLT template) to solve the same task in a few minutes:

  & lt; 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 "& gt; & Lt; Xsl: import href = "str-dvc-map.xsl" /> & Lt; Testmap: testmap / & gt; & Lt; Xsl: output omit-xml-declaration = "yes" indent = "yes" /> & Lt; Xsl: template match = "/" & gt; & Lt; Xsl: select variable name = "vTestMap" = "document ('') / * / testmap: * [1]" /> & Lt; Xsl: call-template name = "string-map" & gt; & Lt; With xsl: select param name = "pFun" = "$ vTestMap" /> & Lt; With xsl: select param name = "pStr" = "/ * / text ()" /> & Lt; / XSL: Call-templates & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: Template name = "escape" mode = "f: fxl" match = "* [namespace-yuri () = 'testmap']" & gt; & Lt; Xsl: Ultimate Name = "Arg 1" /> & lt; XSL: Select & gt; & Lt; Xsl: when test = "$ arg1 = '& amp; lift;' & Gt; & amp; amp; lift; & lt; / xsl: When & gt; & lt; xsl: when test = "$ arg1 => & gt; '& Gt; & Amp; Amp; Gt; & Lt; / Xsl: When & gt; & Lt; Xsl: otherwise & gt; & Lt; Xsl: Select the value = "$ arg1" /> & Lt; / Xsl: otherwise & gt; & Lt; / XSL: Select & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;  

When this change applies to the following XML document :

  & lt; One & gt; & Amp; Lt; In the text & amp; Gt; & Lt; / A & gt;  

The desired result has been produced :

  & amp; Amp; Lt; Text & amp; Gt;  

and in the browser : & amp; L <; & / Html>

Comments