Displaying text from XSL variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paragguptaiiita
    New Member
    • Feb 2008
    • 21

    Displaying text from XSL variable

    I have a XSL variable named $p = 10 155 784 967 24 54 698 78 34 27 21 87 13 15
    This line contains width of 10 roads.
    I am using this code for displaying
    <td><font size="-2"><xsl:valu e-of select="$p"/></font></td>
    but i want to display each coordinate in a separate line.Like this....
    10
    155
    784
    967
    24
    54
    698
    78
    34
    27
    21
    87
    13
    15
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    How did you want to space out the elements? with different <tr> elements? adding <br/> elements?
    [code=xml]
    <xsl:template name="seperate" >
    <xsl:param name="str"/>
    <xsl:param name="delim"/>
    <xsl:choose>
    <xsl:when test="$str = ''"/>
    <xsl:when test="contains( $str, $delim)">
    <xsl:value-of select="substri ng-before($str, $delim)"/>
    <xsl:call-template name="seperate" >
    <xsl:with-param name="str" select="substri ng-after($str, $delim)"/>
    <xsl:with-param name="delim" select="$delim"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise> <xsl:value-of select="$str"/></xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    [/code]

    Also you wouldn't happen to be using XSLT 2.0 would you?

    Comment

    Working...