tags:

views:

30

answers:

2

How come this does not work:

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

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.

Alejandro
+1  A: 

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.

dolmen
@dolmen: Do note that with this param type will be Result Tree Fragment, not string.
Alejandro