SEL-Columbia / pyxform

A Python package to create XForms for ODK Collect.
21 stars 9 forks source link

cannot create string with XML newline character to use in formula #108

Open MartijnR opened 10 years ago

MartijnR commented 10 years ago

The xml newline character is 


PYXForm will convert this to &#10.

Is there a workaround to prevent the & from being converted in the newline character?

I tried using an actual newline (with Ctrl-Enter) in the XLS sheet, but this does not have the desired result.

ukanga commented 10 years ago

I suppose it is possible, we may need to switch from minidom to a different xml library perhaps lxml. I did notice lxml turns \r to 
, not sure if this is what you want. I suppose also, it will still not be possible to use 
 in xls, \r and probably \n will have to do. Not sure when I can get around to this, but am excited about it all together.

MartijnR commented 10 years ago

Glad you're excited about it ;)

a real line break (with Ctrl-Enter) in e.g. the label does actually work correctly. The problem occurred when trying to do this in a formula.

concat($a, ' ', $b)

or

concat($a, '
', $b)

Maybe I can get the former to work on the Enketo side. It would probably be the most user-friendly way. Let me check.