Re: returning PGresult as xml

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: returning PGresult as xml
Дата
Msg-id 40166CE2.2060703@dunslane.net
обсуждение исходный текст
Ответ на Re: returning PGresult as xml  (Scott Lamb <slamb@slamb.org>)
Ответы building plperl on 7.4.1  (Dave Cramer <pg@fastcrypt.com>)
index scan with functional indexes  (Dave Cramer <pg@fastcrypt.com>)
Список pgsql-hackers

Scott Lamb wrote:

> On Jan 25, 2004, at 3:07 AM, Brian Moore wrote:
>
>> <PGresult num_rows='1' num_cols='2'>
>>   <col_desc num='0' type='int4' format='text' name='foo' />
>>   <col_desc num='1' type='int4' format='text' name='bar' />
>>   <row num='0'>
>>     <col num='0'>1</col>
>>     <col num='1'>2</col>
>>   </row>
>> </PGresult>
>
>
> How would you filter for a column in XSLT based on column name with  
> this schema? It's certainly not trivial. I have similar code, and I  
> included the column name as an attribute in each column element for  
> this reason. 



Close to trivial if you set up a key on the col-desc elements, I should 
think. Maybe something like:

<xsl:key name="coldesc" match="col-desc" use="@num" />

...

<xsl:for-each select=" key('coldesc',@num)/@name = 'colname' " >
...

Alternatively you can get there using the parent and preceding-sibling 
axes, but it's less clear.

cheers

andrew





В списке pgsql-hackers по дате отправления:

Предыдущее
От: Scott Lamb
Дата:
Сообщение: Re: returning PGresult as xml
Следующее
От: "Simon Riggs"
Дата:
Сообщение: Re: Recursive optimization of IN subqueries