locked
Extracting only Url from datafield in XSL RRS feed

  • Question

  • Hi tthere,

    I am working on a sharepoint page which uses XSL to extract values from properties in sharepoint pages.

    The values are displayed fine except for the @CustomerURL property. It does not display the CustomerURL values.

    <DataFields>@CustName,CustName;@Title,Title;@CustomerURL,CustomerURL, @CustImage,CustImage,</DataFields>

    Here the @CustName has the CustName value and this is how we display in XSL using:

     <xsl:value-of disable-output-escaping="yes" select="@CustName"/>

    it works fine but the @CustomerURL property does not display the URL value (even though it has the url value). Are we missing something here.

    I noticed that @CustImage also comes with Url, and is there a way we can extract only the url from CustImage? when I write:

     <xsl:value-of disable-output-escaping="yes" select="@CustImage "/>

    The whole image is displayed along with the url. Can I just extract the url from the image instead of displaying both the url and image.

    Please reply.

    Thank you.

     

    • Moved by Mike Walsh FIN Wednesday, July 27, 2011 4:22 AM XSL question so clearly not one for the General forum. (From:SharePoint - General Question and Answers and Discussion (pre-SharePoint 2010))
    Wednesday, July 27, 2011 1:15 AM

Answers

  • Hi there,

    thanks for the reply I figured it out using:

    <xsl:variable name="url"  select= "substring-before(substring-after(@CustImage, '&quot;'), '&quot;')" />

    this extracts only the url from the image. And then simply output the value using the variable url i.e

    <xsl:value-of disable-output-escaping="yes" select="$url"/>

    Thanks and regards!

    Cheers!

    • Marked as answer by Emir Liu Friday, August 5, 2011 6:30 AM
    Wednesday, July 27, 2011 5:34 AM

All replies

  • Is your Data Source coming from a Custom List or Picture Library?

    Can you please specify the Field Types of @CustomerURL and @CustImage?

    Check if this article helps to solve your problem - http://blog.slalomworks.com/2011/02/18/data-view-web-part-tricks/


    Thanks & Regards,
    Kamlesh | Blog | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    • Edited by KSDN Wednesday, July 27, 2011 2:37 AM Provided link to DVWP tricks
    Wednesday, July 27, 2011 2:30 AM
  • Hi there,

    thanks for the reply I figured it out using:

    <xsl:variable name="url"  select= "substring-before(substring-after(@CustImage, '&quot;'), '&quot;')" />

    this extracts only the url from the image. And then simply output the value using the variable url i.e

    <xsl:value-of disable-output-escaping="yes" select="$url"/>

    Thanks and regards!

    Cheers!

    • Marked as answer by Emir Liu Friday, August 5, 2011 6:30 AM
    Wednesday, July 27, 2011 5:34 AM