Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a Custom Filed Type which is rendered in default view (using a simple XSL) like this

StreetName,1,K1,2,1,3,Los Angeles,90210

It's an simple adress. How can I render it like

StreetName, nr. 1

Building K1, Floor 2, Entrance 1, Apt. 3

Los Angeles, 90210

Thank's

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Can you change the delimiter of the field type to something like a semi-colon? It would make it easier to isolate when the breaking should occur. You could then use a XSL Template like this:

<xsl:template name="StringSplit">
  <xsl:param name="val" />
   <xsl:choose>  
    <xsl:when test="contains($val, ';')">   
     <xsl:value-of select="substring-before($val, ';')" />
     <br />     
      <xsl:call-template name="StringSplit">     
       <xsl:with-param name="val" select="substring-after($val, ';')" />     
      </xsl:call-template>  
   </xsl:when>  
   <xsl:otherwise>      
    <xsl:value-of select="$val" />
   </xsl:otherwise>
  </xsl:choose>
</xsl:template>
share|improve this answer
    
The field is a Custom Field Type and yhe delimiter is added by default I think by SharePoint. I've tried a lot of things like param and variables but it seems it can't be incremented using XSLT. –  user3145 Aug 10 '11 at 7:05
    
Hmm, I'm not quite sure how to handle that then, maybe others will chime in with some input. –  PirateEric Aug 10 '11 at 12:16
add comment

Your Answer

 
discard

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.