This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Need 'new line' in list


Linda Zammit <binky_35@yahoo.ca> wrote:
> I am trying to insert a new line in a list in order to
> obtain this html display:
[snip]

As Mike already wrote, Browsers ignore ordinary line feeds in
most parts of HTML documents by design, and using <BR> elements
may be a quick fix (purists generally discourage using <BR>).
Try:
 <xsl:variable name="list">
   <xsl:call-template name="make-list">
     <xsl:with-param name="names" select="stuff"/>
   </xsl:call-template>
 </xsl:variable>
 <xsl:copy-of select="$list"/>
 [...]

 <xsl:template name="make-list">
   <xsl:param name="names"/>
   <xsl:for-each select="$names">
     <xsl:value-of select="."/>
     <xsl:if test="position()!=last()">
       <br/>
     </xsl:if>
     <xsl:if test="position()=last()-1"> and </xsl:if>
   </xsl:for-each>
 </xsl:template>

Note that you'll have to use xsl:copy-of instead
of xsl:value-of in order to use the result properly
(try both to get a feeling why this matters).

Untested. HTH anyway.

J.Pietschmann

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]