home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / sql2txt.stx < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  2.0 KB  |  69 lines

  1. <?xml version="1.0"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <stx:transform xmlns:stx="http://stx.sourceforge.net/2002/ns"
  18.            xmlns:sql="http://apache.org/cocoon/SQL/2.0"
  19.            version="1.0">
  20.  
  21.   <stx:template match="sql:rowset">
  22.     <stx:process-children group="list"/>
  23.   </stx:template>
  24.  
  25.   <stx:group name="list">
  26.     <stx:buffer name="first-row"/>
  27.  
  28.     <!-- Use data from the first row two times, first for header names
  29.     and then for content -->
  30.     <stx:template match="sql:row[1]">
  31.       <stx:result-buffer name="first-row">
  32.     <stx:process-children group="copy"/>
  33.       </stx:result-buffer>
  34.       <stx:process-buffer name="first-row" group="header"/>
  35.       <stx:text> </stx:text>
  36.       <stx:process-buffer name="first-row"/>
  37.       <stx:text> </stx:text>
  38.     </stx:template>
  39.  
  40.     <stx:template match="sql:row">
  41.       <stx:process-children/>
  42.       <stx:text> </stx:text>
  43.     </stx:template>
  44.  
  45.     <stx:template match="sql:*">
  46.       <stx:value-of select="."/>
  47.       <stx:text> </stx:text>
  48.     </stx:template>
  49.   </stx:group>
  50.  
  51.   <!-- Copy everything -->
  52.   <stx:group name="copy">
  53.     <stx:template match="node()">
  54.       <stx:copy attributes="@*">
  55.     <stx:process-children/>
  56.       </stx:copy>
  57.     </stx:template>
  58.   </stx:group>
  59.  
  60.   <!-- Use element names for header -->
  61.   <stx:group name="header">
  62.     <stx:template match="sql:*">
  63.       <stx:value-of select="local-name()"/>
  64.       <stx:text> </stx:text>
  65.     </stx:template>
  66.   </stx:group>
  67.  
  68. </stx:transform>
  69.