Cannot get xslt to output an (&) even after escaping the character

后端 未结 13 1740
轮回少年
轮回少年 2020-12-17 10:13

I am trying to create a query string of variable assignments separated by the & symbol (ex: \"var1=x&var2=y&...\"). I plan to pass this

13条回答
  •  庸人自扰
    2020-12-17 10:38

    You should note, that you can use disable-output-escaping within the value of node or string/text like:

    
    

    or

    
    Texas A&M
    

    Note the single quotes in the xsl:value-of.

    However you cannot use disable-output-escaping on attributes. I know it's completely messed up but, that's the way things are in XSLT 1.0. So the following will NOT work:

    
    

    Because in the fine print is the quote:

    Thus, it is an error to disable output escaping for an or element that is used to generate the string-value of a comment, processing instruction or attribute node;

    emphasis mine.

    Taken from: http://www.w3.org/TR/xslt#disable-output-escaping

提交回复
热议问题