raklos
raklos

Reputation: 28545

append guid to hyperlink using xslt

I have some xml being returned in sharepoint, Im using xslt to create the hyperlink like so.

<a href="{substring-before(Sign-up-Link,',')}">
    Sign up for event
</a>

I also have an element <guid>1234</guid> being returned in the xml, an I'd like it so that the link will be with the guid appended as a querystring

e.g. http://www.foo.com/signup.aspx?guid=1234

how do i append the guid?

thanks

Upvotes: 2

Views: 1148

Answers (3)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243529

<a href="{substring-before(Sign-up-Link,',')}?guid={XPathExpression---Selecting---The---GUID}">
    Sign up for event
</a>

As the actual XML document is not shown, we cannot guess what XPath expression to use in order to select it.

Therefore, In the href attribute of the above literal result element, the second AVT (attribute-value-template) contains just a placeholder for this XPath expression.

Upvotes: 1

Ryan Shripat
Ryan Shripat

Reputation: 5704

        <a>
            <xsl:attribute name="href">
                {substring-before(Sign-up-Link,',')}?guid=
                <xsl:value-of select="@guid">
                </xsl:value-of>
            </xsl:attribute>
            <xsl:attribute name="class">
                SignUpLink
            </xsl:attribute>
            Sign Up
        </a>

That might work...

Upvotes: 1

Nick Allen
Nick Allen

Reputation: 12220

Depends where the guid appears in the xml but I would imagine concat() would do the trick e.g.

<a href="{concat(substring-before(Sign-up-Link,','),'?guid=',guid)}"/>

Upvotes: 1

Related Questions