SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

any one can know what the error in the following code : when I remove the variable LinkTarget1 it will run

<xsl:template name="INeedTo" match="*" mode="itemstyle">
<xsl:variable name="LinkTarget1">
     <xsl:value-of select="substring-before(@URL,',')"></xsl:value-of>

<xsl:variable name="header">
   <![CDATA[<select class="md-ineedto-slct">]]>
<xsl:variable name="footer">
<xsl:if test="count(preceding-sibling::*)=0">
    <xsl:value-of select="$header" disable-output-escaping="yes"></xsl:value-of>

<option value='<xsl:value-of select="$LinkTarget1"/>'>
      <xsl:value-of select="@Title"/>  

<xsl:if test="count(following-sibling::*)=0">
    <xsl:value-of select="$footer" disable-output-escaping="yes"></xsl:value-of>


share|improve this question


<option value='{$LinkTarget1}'>
      <xsl:value-of select="@Title"/>  
share|improve this answer
thanks,but when i used the {} the value will be empty – Ahmad Feb 1 '12 at 14:39
@Ahmad, Maybe because substring-before(@URL,',') returns empty string? Check it. Also, simply use <xsl:variable name="LinkTarget1" select="substring-before(@URL,',')"/> – Kirill Polishchuk Feb 1 '12 at 14:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.