Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a Contenttype with a custom Image with formatting and constraints for publishing -- StockImg.
I have a rollup of all listitems with this Contenttype.
In my ItemStyle.xsl I have created a custom itemstyle

<xsl:template name="StockDisplay" match="Row[@Style='StockDisplay']" mode="itemstyle">
    <xsl:variable name="SafeLinkUrl">
      <xsl:call-template name="OuterTemplate.GetSafeLink">
        <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="SafeImageUrl">
      <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
        <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="DisplayTitle">
      <xsl:call-template name="OuterTemplate.GetTitle">
        <xsl:with-param name="Title" select="substring(@Title, 0 ,25)"/>
        <xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="StockImg">
      <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
         <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
      </xsl:call-template>
    </xsl:variable>
    ...
    <img class="image" src="{$StockImg}" title="" style="border: none;">
    ...
</xsl:template>

in which I would like to get the img url from my custom Publishing Image Field.

I know that by default, you'd use this:

<xsl:variable name="SafeImageUrl">
  <xsl:call-template name="OuterTemplate.GetSafeStaticUrl">
    <xsl:with-param name="UrlColumnName" select="'ImageUrl'"/>
  </xsl:call-template>
</xsl:variable>

But since I want to retrieve the URL from a custom image field, this isn't doing the job for me.
How do I use the above variable to retrieve the URL from my custom image field?

share|improve this question
    
What type are you using for you image field? Is it a "Hyperlink or Picture" field with the URL formatted as a picture? –  EStruyf Nov 30 '11 at 11:57
    
@EStruyf It's the Image with formatting and constraints for publishing field type –  Daniel Ziga Nov 30 '11 at 12:08
add comment

1 Answer

up vote 3 down vote accepted

The format of the Image with formatting and constraints for publishing is already with the image HTML tags.

Ex.:

<img alt="" src="Docs/Image.png" style="border: 0px solid" />

So you could try to do the following:

<xsl:value-of select="substring-before(substring-after(@ImageField, 'src=&quot;'), '&quot; style')" />
share|improve this answer
add comment

Your Answer

 
discard

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.