sql processor - switching xml element depending on db value

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

sql processor - switching xml element depending on db value

cgfoster
Hi All,

I'm using the sql processor and I wondered if there was way to switch xml
elements, depending on the output of my sql query?

So for example, I currently use something like this....:
<sql:result-set>
  <sql:row-iterator>
  <item>
    <sql:attribute name="type">
       <sql:get-column-value type="xs:string" column="NODE_TYPE" />
     </sql:attribute>
     <sql:get-column-value type="xs:string" column="VALUE />
  <item>
 <sql:row-iterator>
<sql:result-set>

which gives me
<item name="section">value1</item>
<item name="item">value2</item>
<item name="item">value3</item>

I would prefer the element <item> to change between <item> and <section>
dependent on the value of NODE_TYPE within the result set.

e.g. to..
<section>value1</section>
<item>value2</item>
<item>value3</item>

Any guidance?

Cheers
Chris


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: sql processor - switching xml element depending on db value

Alexander Žaťko
Chris, you can post-process the sql processor-produced xml with xslt  
or xquery processor.


On Aug 5, 2009, at 5:04 PM, <[hidden email]> wrote:

> Hi All,
>
> I'm using the sql processor and I wondered if there was way to  
> switch xml
> elements, depending on the output of my sql query?
>
> So for example, I currently use something like this....:
> <sql:result-set>
>  <sql:row-iterator>
>  <item>
>    <sql:attribute name="type">
>       <sql:get-column-value type="xs:string" column="NODE_TYPE" />
>     </sql:attribute>
>     <sql:get-column-value type="xs:string" column="VALUE />
>  <item>
> <sql:row-iterator>
> <sql:result-set>
>
> which gives me
> <item name="section">value1</item>
> <item name="item">value2</item>
> <item name="item">value3</item>
>
> I would prefer the element <item> to change between <item> and  
> <section>
> dependent on the value of NODE_TYPE within the result set.
>
> e.g. to..
> <section>value1</section>
> <item>value2</item>
> <item>value3</item>
>
> Any guidance?
>
> Cheers
> Chris
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws