So I have a list in SP2007 and I have a column that has links in it. When I try to pull that into a table on the page using XSLT I get some weird output. Here's my code:

<xsl:element name="a">
<xsl:attribute name="href">
    <xsl:value-of select="@Video_x0020_Url"/>
    <xsl:value-of select="@Video_x0020_Url"/>

Here's what gets output to the page:

<div class=ExternalClass44B1B026A92E4DD59B08DA704C4558B1>http://google.com</div>

I am just using google.com as a placeholder link. We want to add a link to a video but it throws in the div class around it. And the link is broke. It doesn't go to Google.com. Any idea how to get rid of that? Thanks!

1 Answer 1


There is a template on spxslt.codeplex.com that will strip out HTML shown below. Example

<xsl:call-template name="StripHTML"> 
  <xsl:with-param name="HTMLText" select="@Body"/>


<xsl:template name="StripHTML"> 
  <xsl:param name="HTMLText"/>
    <xsl:when test="contains($HTMLText, '&lt;')">
      <xsl:call-template name="StripHTML">
        <xsl:with-param name="HTMLText" select="concat(substring-before($HTMLText, '&lt;'), substring-after($HTMLText, '&gt;'))"/>
      <xsl:value-of select="$HTMLText"/>

For your situation though, I don't thing a rich html field is appropriate if you are just going to use xslt to reformat it. Simply make it a plain text multiline field (if you need more than 255 characters) and there should be no div or use a single line of text field. Then you can use your above element and just swap out the <xsl:value-of> the an <xsl:text> node of Click to View Video.

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.