1

I have an input XML that comes from a Unicode system. I have names for products that look like this:

<MAKTX>Bear &#38; Friends</MAKTX>

My XSLT transforms XML to XML. In my output the above line looks like this: <MAKTX>Bear&lt;(&gt;&amp;&lt;)&gt;Friends</MAKTX>

But I expect <MAKTX>Bear&amp;Friends</MAKTX>

I can't change the input XML from my source system. How do I transform the Unicode &#38; to the HTML entity &amp;?

4

1 回答 1

0

Firstly there is no need to change anything &amp; and &#38; are equivalent markup for a & in both XML and HTML.

If you use

<xsl:output method="html"/>

Then some processors are more likely to use the named form but it is not under your direct control from XSLT just as you can not directly control whether " or ' is used around attribute values, it is just a syntactic variation that no HTML system should care about.

于 2013-03-19T09:26:09.640 回答