PDA

View Full Version : Butting xml text together


gisborne
02-03-2005, 11:21 AM
Assuming suitable xml source, how do I get a sequence of texts with datapaths to appear concatenated?

Something like this:

<text datapath="month/text()" resize="true"><text>, </text><text ddatapath="year/text()" resize="true">

should appear like this:
January, 2005

but instead I get this with every layout that sounds reasonable:
January , 2005

ie the resize is having no effect on the overall layout.

My workaround is to make these objects invisible, and to make another text object constrained to be the concatenation of these two. Inelegant, to say the least.

Is there a better way?

antun
02-04-2005, 09:33 AM
Yes, as a matter of fact there is. You could bind two attributes to the values, and bind the text field to them:


<attribute name="monthtxt" type="string"
value="$path{month/text()}" />
<attribute name="yeartxt" type="string"
value="$path{year/text()}" />

<text text=${parent.monthtxt + ' ' + parent.yeartxt}" />


-Antun

My workaround is to make these objects invisible, and to make another text object constrained to be the concatenation of these two. Inelegant, to say the least.

Is there a better way?