RE: [xsl] format-number()-function question

Subject: RE: [xsl] format-number()-function question
From: "Amuchastegui, Maria" <Maria.Amuchastegui@xxxxxxxxxxx>
Date: Thu, 18 Dec 2003 15:14:49 -0500
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: [xsl] 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