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

RE: format-number()-function question

Subject: RE: format-number()-function question
From: "Amuchastegui, Maria" <Maria.Amuchastegui@xxxxxxxxxxx>
Date: Thu, 18 Dec 2003 15:14:49 -0500
xsl format number
You could create a named template with the format-number function, and then
call the template.

	<xsl:decimal-format name="EnglishDecimalFormat"
decimal-separator="." grouping-separator=","/>
	<xsl:template name="EnglishCurrency">
		<xsl:value-of select="format-number(., '$##,##0.00',
'EnglishDecimalFormat')"/>
	</xsl:template>

	<xsl:apply-templates select=".">
		<xsl:call-template name="EnglishCurrency"/>
	</xsl:apply-templates>

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jonny Pony
Sent: December 18, 2003 2:43 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  format-number()-function question


Hi,

I'm using the format-number()-function and I wonderd if I could do this 
piece of code without the variable. What I mean is, inserting the 
"><xsl:value-of select="."/>" directly into the function. Is that somehow 
possible. Does it make sense?

<xsl:choose>
<xsl:when test="@type = 'decimal'">
<xsl:variable 
name="number"><xsl:value-of select="."/></xsl:variable>
<xsl:value-of 
select="format-number($number, '###,###.00')"/>
	</xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>

Thanks
Jonny

Since I don't know any XML-Schema forum:

I want for XML-output something like this
...
<Row>
<Entrie type="decimal" digits="3">blabla</Entrie>
<Entrie type="integer" digits="0">blabla</Entrie>
</Row>

My schema:
...
<xs:sequence>
<xs:element name="Entrie" type="xs:string">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="xs:anyType">
<xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="digits" type="xs:integer" use="optional"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:sequence>

But this "schema code" doesn't function.
When I want to validate my xml against this schema in XMLSpy it says 
"unexpected attributes". Without attributes I can validate it. Strange.
Am I right or XMLSpy?
Or does anyone know an xml-schema forum to post this question

_________________________________________________________________
E-Mails sind Ihnen nicht schnell genug? http://messenger.msn.de MSN 
Messenger - Kommunikation in Echtzeit


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

 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.