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




---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to