开发者

adding select-attribute using the "attribute"-tag in xslt not working

How come this does not work:

<xsl:with-param name="message">
  <xsl:attribute name="select">
     <xsl:text>开发者_JAVA百科;'Alla koder kopplade till den e-post-adressen är nu skickade till dig!'</xsl:text>
  </xsl:attribute>
</xsl:with-param>


You need:

<xsl:with-param name="message" 
select="'&apos;Alla koder kopplade till den e-post-adressen är nu skickade till dig!&apos;'"/> 

Whenever you declare a param or variable without select attribute and with some content template, the variable or parameter will be of type Result Tree Fragment. Whenever you output an attribute node, it's an error if you don't output it before any other node type of some element's content template. Error recovery mechanism could be to silently output nothing. In XSLT 2.0 the error is rised.

Note: I'm ussing &apos; entity because you have wrapped the text with ', otherwise it's no needed.


You can totally avoid using the select attribute simply by giving the value as the text node inside the <xsl:with-param>:

<xsl:with-param name="message">'Alla koder kopplade till den e-post-adressen är nu skickade till dig!'</xsl:with-param>

And you probably don't need the quotes (') except if you want them in the value of message.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜