0

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

1 Answer 1

2

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>
2
  • 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, 2011 at 7:05
  • Hmm, I'm not quite sure how to handle that then, maybe others will chime in with some input. Aug 10, 2011 at 12:16

Your Answer

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

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