0

So I am doing a project in Sharepoint 2010 environment. I have an xsl template to retrieve the value of a page url. Currently this is the value that is being returned.

http://sitebuilder2/corporate/issues/Pages/issues/Pages/Operations/Hazardous%20Material%20Spill-Release/index.aspx

The value I need for the URL is:

http://sitebuilder2/corporate/issues/Pages/Operations/Hazardous%20Material%20Spill-Release/index.aspx

Is there a way within my xsl to remove the first '/issues/Pages' from my string so that the url returns correctly?

1 Answer 1

1

I have assigned value of the URL to $myUrl variable just for the explanation

<xsl:variable name="myUrl">
    <xsl:value-of select="'http://sitebuilder2/corporate/issues/Pages/issues/Pages/Operations/Hazardous%20Material%20Spill-Release/index.aspx'"/>
</xsl:variable>

In your xslt you should be able to remove the first '/issues/Pages' as below

<xsl:value-of select="concat(substring-before($myUrl,'/issues/Pages'),substring-after($myUrl,'issues/Pages'))"/>

Result is

http://sitebuilder2/corporate/issues/Pages/Operations/Hazardous%20Material%20Spill-Release/index.aspx

Your Answer

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

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