Hi Erol,
Yes, you can.
Something like the following should work:
element book {
for $i in 1 to $n
return attribute {"isbn_" || $i} {get-value($i)}
}
Cheers,
Dirk
--
On 06/05/14 19:48, Erol Akarsu wrote:
> I would like to create an xml element that will have dynamic number of
> attributes, something like this where n will change and $value_1 to
> $value_2 will be provided by outside
>
> element book {
> attribute isbn_1 {$value_1}
> attribute isbn_2 {$value_2}
> attribute isbn_3 {$value_3}
> .
> .
> .
> attribute isbn_n {$value_n}
> }
>
> Can we do it?
>
> Thanks
>
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22