dynamic number of attributes
Tuesday, 6 May 2014 · 7 messages · last reply 7 May 2014
DK
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
Quoted text · Erol Akarsu · 19 lines
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
ML
Hi Erol,.
try
element book {
for $i in 1 to 4
return attribute {xs:QName("isbn_" || $i)} { "value" || $i}}
Regards,
Marco.
Quoted text · Erol Akarsu · 18 lines
On 06/05/2014 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
ML
Marco Lettere6 May 2014 20:08 #
Sorry for double posting :-D
M.
Quoted text · Marco Lettere · 34 lines
On 06/05/2014 20:07, Marco Lettere wrote: > Hi Erol,. > try > > element book { > > for $i in 1 to 4 > return attribute {xs:QName("isbn_" || $i)} { "value" || $i} > > } > > Regards, > Marco. > > On 06/05/2014 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 > >
EA
Erol Akarsu6 May 2014 21:48 #
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
EA
Dirk,
Super duper!
Quoted text · Dirk Kirsten · 42 lines
On Tue, May 6, 2014 at 1:55 PM, Dirk Kirsten <dk at basex.org> wrote: > 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 >
DK
Hello Erol,
Some time ago we had a short discussion on the ML about using clob with Oracle:
https://mailman.uni-konstanz.de/pipermail/basex-talk/2014-March/006481.html
Blob is even a standard java.sql type and should work fine. If not, don't hesitate to report a bug here.
Cheers,
Dirk
PS: Next time you might want to start a new conversion with a different title... makes stuff easier to find in the future for other people, which might run into the same problem.
Quoted text · Erol Akarsu · 55 lines
On 07/05/14 21:35, Erol Akarsu wrote: > Thanks Marco, > > I have another question. > I am trying to use Basex's SQL functions. I have tried some basic SQL > commands for connecting and selecting some rows from table, it works fine. > > For my project, I need to upload and export pdf document/word > doc/images form/into Oracle database that needs some special > oracle-specific stuff. > Has anybody tried to upload blob/digital document to Oracle with Basex? > I appreciate any help > > Erol Akarsu > > > On Tue, May 6, 2014 at 2:07 PM, Marco Lettere <marco.lettere at dedalus.eu > <mailto:marco.lettere at dedalus.eu>> wrote: > > Hi Erol,. > try > > element book { > > for $i in 1 to 4 > return attribute {xs:QName("isbn_" || $i)} { "value" || $i} > > } > > Regards, > Marco. > > > On 06/05/2014 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
EA
Thanks Marco,
I have another question.
I am trying to use Basex's SQL functions. I have tried some basic SQL commands for connecting and selecting some rows from table, it works fine.
For my project, I need to upload and export pdf document/word doc/images form/into Oracle database that needs some special oracle-specific stuff. Has anybody tried to upload blob/digital document to Oracle with Basex? I appreciate any help
Erol Akarsu
On Tue, May 6, 2014 at 2:07 PM, Marco Lettere <marco.lettere at dedalus.eu>wrote:
Quoted text · Marco Lettere · 36 lines
> Hi Erol,. > try > > element book { > > for $i in 1 to 4 > return attribute {xs:QName("isbn_" || $i)} { "value" || $i} > > } > > Regards, > Marco. > > > On 06/05/2014 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 >> > >
Written for BaseX 7.8. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery