开发者

Using special characters in XSL

I am trying to include special characters such as £, #, " in an XSL document, but have been unable to find a good way to do this. If anybody can suggest a way to achieve this, I'd be very grateful. Example below.

Nick

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:template match="/">
<HTML>
  <HEAD></HEAD>
  <BODY>
    <TABLE>
      <TR>
        <TD>Account&nbsp;Name</TD>
        <TD>Finish</TD>
        <TD>Start</TD>
        <TD>Completed</TD>
        <TD>Completed&nbsp;Date</TD>
        <TD>Day</TD>
        <TD>User</TD>
        <TD>Your&nbsp;Name</TD>
        <TD>Company&nbsp;Name</TD>
        <TD>Job&nbsp;Title</TD>
        <TD>Would&nbsp;you&nbsp;like&nbsp;to&nbsp;attend?</TD>
     </TR>
      <xsl:for-each select="NewDataSet/Table">
        <TR>
          <TD>
            <xsl:value-of disable-o开发者_如何学Cutput-escaping="yes" select="Account&nbsp;Name"/>
          </TD>
          <TD>


Just put the characters in the file as is, £ and # aren't special characters.

Your problem is the &nbsp; this is not a known entity in XML only in HTML and hence your XSL is invalid. I would use &#160; which is the unicode character entity for the non-breaking space.

Save your file as UTF-8 is also a good idea.


You can use the xsl:text tag for this, link text

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜