Using an HTML entity in XSLT (e.g.  )

前端 未结 11 2046
无人及你
无人及你 2020-11-28 07:29

What is the best way to include an html entity in XSLT?


    
    &am         


        
相关标签:
11条回答
  • 2020-11-28 07:42

    One space character between text tags should be enough.

    0 讨论(0)
  • 2020-11-28 07:47

    Thank you for your information. I have written a short blog post based on what worked for me as I was doing XSLT transformation in a template of the Dynamicweb CMS.

    The blog post is here: How to add entities to XSLT templates.

    /Sten Hougaard

    0 讨论(0)
  • 2020-11-28 07:48

    It is necessary to use the entity #x160;

    0 讨论(0)
  • 2020-11-28 07:58

    I had no luck with the DOCTYPE approach from Aku.

    What worked for me in MSXML transforms on an Windows 2003 server, was

        <xsl:text disable-output-escaping="yes">&amp;#160;</xsl:text>
    

    Sort of a hybrid of the above. Thanks Stackoverflow contributors!

    0 讨论(0)
  • 2020-11-28 08:01

    I found all of these solutions produced a  character in the blank space.

    Using <xsl:text> </xsl:text> solved the problem for me; but <xsl:text>#x20;</xsl:text> might work as well.

    0 讨论(0)
  • 2020-11-28 08:02

    You can use CDATA section

    <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text>
    

    or you can describe &nbsp in local DTD:

    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
    

    or just use &#160; instead of &nbsp;

    0 讨论(0)
提交回复
热议问题