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]
Other format: [Raw text]

RE: how to append a "," to the end of number


Hi Mac,

If I understand you correctly, you want something like this:

XML

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="comma separated.xslt"?>
<Rates>
	<NightlyRate>100</NightlyRate>
	<NightlyRate>200</NightlyRate>
	<NightlyRate>300</NightlyRate>
</Rates>

XSLT

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<input type="hidden" name="NightlyRates">
			<xsl:attribute name="value">
				<xsl:for-each select="/Rates/NightlyRate">
					<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
				</xsl:for-each>
			</xsl:attribute>
		</input>
	</xsl:template>
</xsl:stylesheet>

Output

<input type="hidden" name="NightlyRates" value="100, 200, 300">

Hope that helps,

cheers

Malcolm


-----Original Message-----
From: Mac Rost [mailto:mrost@travelnow.com]
Sent: Monday, August 26, 2002 5:03 PM
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] how to append a "," to the end of number


I have this problem, I have an unknown number of prices that will be
separated with a comma. I need to know if it is possible to do this in
my xsl.

					
<input type="hidden" name="NightlyRates">
<xsl:attribute name="value"><xsl:value-of
select="NightlyRates"/></xsl:attribute>
</input>

This is my problem here. NightlyRates will have 1-M occurrences and it
needs to be formatted like this. 54.95, 65.95 and so on.
Thank you for all your help!

Mac Rost
Affiliate Relations/XML Developer
TravelNow.com a wholly owned subsidiary of 
Hotel Reservations Network 
mailto:xml@travelnow.com



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


 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]