Pergunta

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?

Foi útil?

Solução

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')" />
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top