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

Adding a break character between a group of input data

Subject: Adding a break character between a group of input data except for the lastentry
From: "Steve Assad" <SAssad@xxxxxxxxxxx>
Date: Thu, 29 Nov 2001 16:19:09 -0800
steve assad
Vendor: Microsoft XML Parser(MSXML)3.0
Processor version: XML SPY version 3.5

 Slice of input XML file
      <prescriber-info>
        <trade-name>Acephen</trade-name>
      </prescriber-info>
      <prescriber-info>
        <trade-name>Aceta</trade-name>
      </prescriber-info>
      <prescriber-info>
        <trade-name>Acetaminophen Uniserts</trade-name>
      </prescriber-info>
      <prescriber-info>
        <trade-name>Apacet</trade-name>
      </prescriber-info>
      <prescriber-info>
        <trade-name>Aspirin Free</trade-name>
      </prescriber-info>
      <prescriber-info>
        <trade-name>Pain Relief</trade-name>
      </prescriber-info>
      <prescriber-info>
        <trade-name>Children's</trade-name>
      </prescriber-info>

Problem:
Trying to extract all the <trade-name> into a single tag. Each <trade-name>
separated be a ';' except for the last one.

Example out put needed:

<annotationsText>

           <variable_line> Acepta; Acetaminapphen Uniserts; Apacet; Aspirin
Free; Pain Relief; Children's </variable_line>
</annotationsText>

What I have tried to do.

             <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"/>
                             <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

;  Acepta;  Acepta; Acetaminapphen Uniserts; Apacet; Aspirin Free; Pain
Relief; Children's

It does work if there is only one trade-name on the list. for eample if
there is only Acepta as a tradename the output will be correct.
It does not work if there is a list of trade-names.
Thanks in advance.


 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.