SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create custom XSLT for a multi lookup field, based on this article. When changing disable-output-escaping to yes I can see the html I want to modyify:

<a onclick="OpenPopUpPage('http://...', RefreshPage); return false;"
<a onclick="OpenPopUpPage('...', RefreshPage); return false;"

Now what I want to achieve, is:
1) change the links text (7 and 17 are some field values from lookup list, they're not itemIDs on this list) to multiply the values by a value from another column (C) (I can access it, so probably would pass it as a parameter to template)
2) split the displayed items with some charactrer, like '|'
So what I want to get after modifications would be (if C value = 2): 14 | 34 instead of 7; 17 which is normaly displayed in this mulitlookup column. Is it possible to modify the script I'm using to achieve this?

share|improve this question

You'll need to have all the values as either properties (@columnname) or as parameters ($parameterOfColumnname) and use the XSLT method sum().

<xsl:variable name="multiplyingValue">
    <xsl:value-of select="@multiplyingValue" />
<xsl:variable name="firstNumber">
    <xsl:value-of select="@firstNumber" />
<xsl:variable name="secondNumber">
    <xsl:value-of select="@secondNumber" />

<xsl:if test="$multiplyingValue != ''">
    <xsl:value-of select="sum($firstNumber * $multiplyingValue)" />
    <xsl:value-of select="sum($secondNumber * $multiplyingValue)" />

I'm not 100% sure if sum() is needed. I've seen examples on this without using sum() but still doing the <xsl:value-of select="value here * $multiplyingValue" />

Hope this helps :)

share|improve this answer
I was quite busy with other stuff, i forgot about this one sorry. well unfortunately i'm not able to get the values yet, the way I try to get them now (just the ones from multilookup, so I don't think about $multiplyingValue yet) is to parse the value of the field (like 1;#7;#2:17). I managed to get something like this in a variable: <ids><id>1</id><id>7</id><id>2</id><id>17</id></ids> so I thought iterating through this and getting every second value would work, but I cant iterate with for-each though this. – matt137 Oct 16 '12 at 13:29
I try: <xsl:for-each select="msxsl:node-set($tokens)/ids/id"> <xsl:value-of select="." /> </xsl:for-each> but nothing gets displayed..any ideas? sorry for duble-comment btw – matt137 Oct 16 '12 at 13:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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