Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep getting error - Attribute 'grouping-separator' is invalid

Status
Not open for further replies.

ade234uk

Technical User
Sep 28, 2006
9
GB
My xml docs where working fine over a month ago. I have just gone to update the xml file and I am now receiving the following error.

Attribute 'grouping-separator' is invalid on 'xsl:value-of'.

I was wondering if someone could help. The code from my xsl can be found below
//////////////////////////////////

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0" xmlns:xsl="
<xsl:template match="/">
<html>
<body bgcolor="#4A8FE5">
<center><img src="spn_toplogo_general.gif" /></center><br />

<h2><font face="Arial" color="#ffffff" size="4"><center>Latest Properties Costa Blanca North Inland</center></font></h2>
<center><table border="0" width="735">
<tr bgcolor="#9acd32">

<th align="left">Property deatils</th>
<th align="left">Property image</th>

</tr>
<xsl:for-each select="root/property">
<xsl:sort select="price" order="ascending" data-type="number"/>
<tr>
<td valign="top"><font face="arial" size="2" color="white"><b><xsl:value-of select="type" /> - <xsl:value-of select="town" /> - <xsl:value-of select="province" /> - <xsl:value-of select="location_detail" />
<br />Posted On: <xsl:value-of select="date"/> - Lot no: <xsl:value-of select="ref"/></b></font>
<br /><br />
<font face="arial" size="2" color="white"><b>Number of Bedrooms: </b><xsl:value-of select="beds"/> - <b>Number of Bathrooms: </b> <xsl:value-of select="baths"/></font>
<br /><br />
<font face="arial" size="2" color="white"><xsl:value-of select="desc" />
<br /><br /></font>
<font face="arial" size="3" color="white"><b>Euros <xsl:value-of select="price" grouping-separator=","/></b></font><br /><br /><br /><br />

</td>
<td valign="top"><img><xsl:attribute name="src"><xsl:value-of select="images//url"/></xsl:attribute></img>
<br /><br /><center><font face="arial" size="2" color="white">Telephone: <b>01556 610712</b><br /> For further information on this property<b><br /><br /> MORE PHOTOGRAPHS? </b><br /> Contact us if you require more photographs <br /> to be emailed to you</font></center></td>
</tr>
</xsl:for-each>
</table></center>
</body>
</html>
</xsl:template>

</xsl:stylesheet>
 
[1] If you want to format a number retrieve from the node in xsl:value-of element, you should use format-number() function. For instance, like this.

><xsl:value-of select="price" grouping-separator=","/>
[tt]<xsl:value-of select="format-number(price,'###,###.00'" />[/tt]

[2] There is an element xsl:number which can be used in outputting number with value from some node and it supports grouping-size and grouping-separator attributes, etc. Although it is mainly used in numbering, it can be used here; but then, it is rounding to integer. Note that grouping-separator will be ignored if grouping-size is not specified. Hence, your original line seems defective in any case.

><xsl:value-of select="price" grouping-separator=","/>
[tt]<xsl:number value="price" grouping-size="3" grouping-separator="," />[/tt]

[3] There is also xsl:decimal-format which supports grouping-separator attribute. But, xsl:decimal-format is mainly used with format-number() built-in function which seems not the case here.
 
Amendment
There's an obvious typo in [1], missing closing parenthesis. The corresponding line should be read like this.
[tt] <xsl:value-of select="format-number(price,'###,###.00'[red])[/red]" />[/tt]
 
Thank you very much. It is now working. Again Thank You for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top