apostroph in group-separator (@xxforms:format)

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

apostroph in group-separator (@xxforms:format)

f.blanc
Hi,

I want to put an apostroph (')  as group separator for the format-number function but I don't see how to do it (with xslt it's ok but I need to do it with the @xxforms:format)

Here I use coma but I would like to use '...
<xforms:output ref="instance('main')/data" xxforms:format="format-number((.), '###,###,##0.00')"/>

Thanks



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: apostroph in group-separator (@xxforms:format)

Ryan Puddephatt
Hi,
        I think you need to escape it (&apos;)

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: [hidden email] [mailto:[hidden email]]
>Sent: 12 February 2007 16:13
>To: [hidden email]
>Subject: [ops-users] apostroph in group-separator (@xxforms:format)
>
>Hi,
>
>I want to put an apostroph (')  as group separator for the
>format-number function but I don't see how to do it (with xslt
>it's ok but I need to do it with the @xxforms:format)
>
>Here I use coma but I would like to use '...
><xforms:output ref="instance('main')/data"
>xxforms:format="format-number((.), '###,###,##0.00')"/>
>
>Thanks
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: apostroph in group-separator (@xxforms:format)

Erik Bruchez
Administrator
In reply to this post by f.blanc
Frederic,

This answer I sent yesterday may help:

http://www.nabble.com/Re%3A-format-number-with-custom-decimal-format-not-working-p8922537.html

I think what we would need ideally is the ability to define a decimal
format as defined in XSLT:

   http://www.w3.org/TR/xslt20/#element-decimal-format

In the meanwhile, translate() will be your friend.

-Erik

[hidden email] wrote:
> Hi,
>
> I want to put an apostroph (')  as group separator for the format-number function but I don't see how to do it (with xslt it's ok but I need to do it with the @xxforms:format)
>
> Here I use coma but I would like to use '...
> <xforms:output ref="instance('main')/data" xxforms:format="format-number((.), '###,###,##0.00')"/>
>
> Thanks

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: apostroph in group-separator (@xxforms:format)

f.blanc
> Ryan :
> I think you need to escape it (&apos;)

I've already try it but &apos; is not escaped :'o(

<xforms:output ref="/double" xxforms:format="format-number(., '###&apos;##0.00')" />
==> unmatched quote in expression

> Erik :
> translate is your friend

And with translate I've try this :

<xforms:output ref="/double" xxforms:format="translate(format-number(., '###,##0.00'), '&apos;'" />

and this

<xforms:output ref="/double" xxforms:format="translate(format-number(., '###,##0.00'), &apos;" />

but I receive always "unmatched expression" : the &apos; cannot be escaped and there is no way of calling a variable as in xslt...

In XSL we can have variable and it works (as I said in the first post) but I need to use the @xxforms:format...

Here with xsl it works but How can I do the same in the @xxforms:format (call a variable)
<xsl:template name="displayMoney">
  <xsl:param name="number" select="0"/>
  <xsl:variable name="apos">'</xsl:variable>
  <xsl:value-of select="translate(format-number($number, '###,###,###.00 CHF'), ',', $apos)"/>
</xsl:template>

And I've even try to have the ' character in my XFormsInstance (!) and call it in the translate function but : an empty sequence is not allowed as the third argument of translate()...

The only solution I've found is to use the ยด character in state of '...
But if you find a solution, I'm interested in.

Thanks




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: apostroph in group-separator (@xxforms:format)

Ryan Puddephatt
Well there is one way, but it's a bit hacky. You could store an element in
an instance which contains '. E.g.

<instance>
        <apos>'</apos>
</instance>

And then refer to it

<xforms:output ref="/double" xxforms:format="translate(format-number(.,
'###,##0.00'), instance('some-instance')/apos)" />

This could work :-)

Ryan

Ryan Puddephatt
Software Engineer

Teleflex Group - IT UK
1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

e> [hidden email]
t> +44(0)1506 407 110
f> +44(0)1506 407 108

 

>-----Original Message-----
>From: [hidden email] [mailto:[hidden email]]
>Sent: 13 February 2007 15:20
>To: [hidden email]
>Subject: Re: Re: [ops-users] apostroph in group-separator
>(@xxforms:format)
>
>> Ryan :
>> I think you need to escape it (&apos;)
>
>I've already try it but &apos; is not escaped :'o(
>
><xforms:output ref="/double" xxforms:format="format-number(.,
>'###&apos;##0.00')" /> ==> unmatched quote in expression
>
>> Erik :
>> translate is your friend
>
>And with translate I've try this :
>
><xforms:output ref="/double"
>xxforms:format="translate(format-number(., '###,##0.00'), '&apos;'" />
>
>and this
>
><xforms:output ref="/double"
>xxforms:format="translate(format-number(., '###,##0.00'), &apos;" />
>
>but I receive always "unmatched expression" : the &apos;
>cannot be escaped and there is no way of calling a variable as
>in xslt...
>
>In XSL we can have variable and it works (as I said in the
>first post) but I need to use the @xxforms:format...
>
>Here with xsl it works but How can I do the same in the
>@xxforms:format (call a variable) <xsl:template name="displayMoney">
>  <xsl:param name="number" select="0"/>
>  <xsl:variable name="apos">'</xsl:variable>
>  <xsl:value-of select="translate(format-number($number,
>'###,###,###.00 CHF'), ',', $apos)"/> </xsl:template>
>
>And I've even try to have the ' character in my XFormsInstance
>(!) and call it in the translate function but : an empty
>sequence is not allowed as the third argument of translate()...
>
>The only solution I've found is to use the 4 character in state of '...
>But if you find a solution, I'm interested in.
>
>Thanks
>
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: Re: apostroph in group-separator (@xxforms:format)

f.blanc
Thanks it works! ^^

I've try this before but the instance where I have the apostroph character was erased (that's why I was always receiving the error that an empty sequence was not allowed -_-')

Thank you very much!



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: apostroph in group-separator (@xxforms:format)

Joseph Lawrence
Hi,
<xforms:output ref="/double" xxforms:format='translate(format-number(.,
                        "###,##0.00"),",", "&apos;")'/>
this also works.

Thanks
Joseph Lawrence
Stabilix Solutions

[hidden email] wrote:
Thanks it works! ^^

I've try this before but the instance where I have the apostroph character was erased (that's why I was always receiving the error that an empty sequence was not allowed -_-')

Thank you very much!


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: apostroph in group-separator (@xxforms:format)

Erik Bruchez
Administrator
In reply to this post by f.blanc
 > but I receive always "unmatched expression" : the &apos; cannot be
 > escaped and there is no way of calling a variable as in xslt...

Apostrophes cannot be escaped in XPath 1.0, but in XPath 2.0, you
simply double it, e.g. you can write something like:

   translate(..., ',', '''')

A precision as some may be confused: after all, why doesn't &apos;
escape the apostrophe? Well, it's just that &apos; is an XML character
entity, and it is escaped during *XML parsing*. So after your XForms
page is loaded, the XForms engine just sees an attribute which
contains some apostrophe characters, and has no idea that some were
initially written literally, and others written as &apos;. You could
even write the apostrophe as a numeric character entity (&#x27;) and
it would not make a difference.

The content of the attribute is then passed to an XPath engine, which
really has nothing to do with the XML syntax anymore. The XPath engine
just sees a bunch of characters that it tries to analyze as a valid
XPath 2.0 expression. This explains why escaping an apostrophe in an
XPath string is a feature of the XPath language, and not a feature of
XML.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: apostroph in group-separator (@xxforms:format)

Erik Bruchez
Administrator
In reply to this post by Joseph Lawrence
That's right, and you don't even need to use &apos;: you can use the
apostrophe directly.

-Erik

Joseph Lawrence wrote:

> Hi,
> <xforms:output ref="/double" xxforms:format='translate(format-number(.,
>                         "###,##0.00"),",", "&apos;")'/>
> this also works.
>
> Thanks
> Joseph Lawrence
> Stabilix Solutions
>
> */[hidden email]/* wrote:
>
>     Thanks it works! ^^
>
>     I've try this before but the instance where I have the apostroph
>     character was erased (that's why I was always receiving the error
>     that an empty sequence was not allowed -_-')
>
>     Thank you very much!
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws