[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Adding a break character between a group of input

Subject: Re: Adding a break character between a group of input data except for the last entry
From: Jörg Heinicke <joerg.heinicke@xxxxxx>
Date: Fri, 30 Nov 2001 01:44:11 +0100
adding blank character in xslt
Hi Steve,

it's really easy with position() and last():

<xsl:for-each select="prescriber-info/trade-name">
    <xsl:value-of select="text()"/>
    <xsl:if test="position() != last()">; </xsl:if>
</xsl:for-each>

or like your one with the 1st position:

<xsl:for-each select="prescriber-info/trade-name">
    <xsl:if test="position() != 1">; </xsl:if>
    <xsl:value-of select="text()"/>
</xsl:for-each>

>              <annotationsText>
>                <xsl:variable name="line"
select="prescriber-info/trade-name
> "/>
>                    <xsl:for-each select="prescriber-info/trade-name">
>                              <xsl:variable name="trade_names" select="
> prescriber-info/trade-name"/>

The error is here. <xsl:for-each> changes the context-node. And you want to
have prescriber-info/trade-name/prescriber-info/trade-name in your variable,
what's always empty. Using it this way it has to be <xsl:variable
name="trade_names" select="text()"/> or select="." .

>                              <xsl:if test= "$trade_names != $line">; </
> xsl:if> <xsl:value-of select="."/></xsl:for-each>
>              </annotationsText>
> The if statement always comes out false. Which means $trade_name equals
> $line. Why? How else could I get it done.
> output from above code

Regards,

Joerg


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.