views:

513

answers:

3

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

+1  A: 

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)}"/>
Nick Allen - Tungle139
Why do you think that "Sign-up-Link" has a sibling named "guid"? The problem says: "I also have an element <guid>1234</guid> being returned in the xml" ... Most vague description. Also, the concat() function is not really needed -- see my answer.
Dimitre Novatchev
Yes it's vague that's whay I said it depends where the guid elements appears in the xml, my assumption of sibling position is for illustration purposes
Nick Allen - Tungle139
+1  A: 
  <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...

Ryan Shripat
THis will not produce the required result. The problem says that the "guid" is an element somewhere in the xml document -- not an attribute of the parent of "Sign-up-Link"
Dimitre Novatchev
+1  A: 
<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.

Dimitre Novatchev