0

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>

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

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

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

</xsl:template>


</xsl:stylesheet>

1 Answer 1

1

Use:

<option value='{$LinkTarget1}'>
      <xsl:value-of select="@Title"/>  
</option>
2
  • thanks,but when i used the {} the value will be empty
    – amd
    Commented Feb 1, 2012 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,',')"/> Commented Feb 1, 2012 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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