用cocoon call webservice 生成 html,excel

xsp 代码
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsp:page language="java"
  xmlns:xsp="http://apache.org/xsp"
  xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  xmlns:xscript="http://apache.org/xsp/xscript/1.0"
  xmlns:soap="http://apache.org/xsp/soap/3.0" >
 
  <page>
      <content>
      <xsp:logic>

       String cFCType= request.getParameter("cFCType");
       String cPFrom= request.getParameter("cPFrom");
 <para>
        <xsp:expr>iStartYear</xsp:expr>
 </para>
 <para>
   <soap:call url="http://gpaukwsa.gpe-hkg.com:8080/wsa/wsa1">
     <ns1:getcurrforecast xmlns:ns1="urn:www.gpe.com:forecast:forecast">
     <soap:enc/>
      <cFCType xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsp:expr>cFCType</xsp:expr></cFCType>
      <cPFrom xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsp:expr>cPFrom</xsp:expr></cPFrom>
     </ns1:getcurrforecast>
   </soap:call>
 </para>

      </xsp:logic>
      </content>
  </page>
 
</xsp:page>

xml2html 代码

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<xsl:output method="html"/>

<xsl:template match="/">
<xsl:variable name="s" select="number(//fp_id_12)"/>
<table border="0" width="100%" height="50">
<tr>
<td width="30%" align="left">
<img border="0" src="https://www.gpacoustics.com/ctrl/ukweb/forecast/images/uklogo.jpg" width="120" height="60"></img>
</td>
<td width="40%" align="center" style="font-size: 30pt"><b><u>Forecast Report</u></b></td>
<td width="30%" align="right" style="font-size: 14pt">
<SCRIPT>
document.write(Date());
</SCRIPT>
</td>
</tr>
</table>
<table border="0" bgcolor="#66CCFF" width="100%" style="border: 1px #66CCFF" cellspacing="1" cellpadding="1">
 <tr bgcolor="#66CCFF">
   <th style="font-size: 9pt"><nobr>Part No</nobr></th>
   <th style="font-size: 9pt"><nobr>Description</nobr></th>
 </tr>
 <xsl:for-each select="//Item">
  <tr bgcolor="#FFFFFF">
  <td style="font-size: 9pt"><nobr><xsl:value-of select="product_code"/></nobr></td>
  <td style="font-size: 9pt"><nobr><xsl:value-of select="description"/></nobr></td>
 </xsl:for-each>
</table>

</xsl:template>

</xsl:stylesheet>

xml2xls 代码
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:sql="http://apache.org/cocoon/SQL/2.0"
                             xmlns:gmr="http://www.gnome.org/gnumeric/v7" >
  <xsl:output method="xml" />
  <xsl:template match="/">
 <gmr:Workbook xmlns:gmr="http://www.gnome.org/gnumeric/v7">
      <gmr:SheetNameIndex>
        <gmr:SheetName>Sheet 1</gmr:SheetName>
      </gmr:SheetNameIndex>
      <gmr:Sheets>
        <gmr:Sheet>
          <gmr:Name>Sheet 1</gmr:Name>

          <gmr:Styles>
            <gmr:StyleRegion startRow="0" endRow="0" startCol="0" endCol="99">
               <gmr:Style HAlign="8" VAlign="4" WrapText="0" Orient="1"
                         Shade="0" Indent="0" Locked="1" Hidden="0"
                         Fore="0:0:0" Back="FFFF:FFFF:FFFF"
                         PatternColor="0:0:0" Format="General">
                <gmr:Font Unit="10" Bold="1" Italic="0" Underline="0" StrikeThrough="0">
                  Helvetica
                </gmr:Font>
              </gmr:Style>
            </gmr:StyleRegion>
          </gmr:Styles>

          <gmr:Cells>
       <xsl:call-template name="headerrow"/>
            <xsl:apply-templates select="//Item"/>
          </gmr:Cells>
        </gmr:Sheet>
      </gmr:Sheets>
    </gmr:Workbook>
</xsl:template>
<xsl:template name="headerrow">
      <gmr:Cell Row="0" Col="0" ValueType="60">Part No</gmr:Cell>
  <gmr:Cell Row="0" Col="1" ValueType="60">Description</gmr:Cell>
</xsl:template>
<xsl:template match="Item">
    <xsl:variable name="row" select="position()"/>
    <gmr:Cell Row="{$row}" Col="0" ValueType="60">
      <xsl:value-of select="product_code"/>
    </gmr:Cell>
    <gmr:Cell Row="{$row}" Col="1" ValueType="60">
      <xsl:value-of select="description"/>
    </gmr:Cell>
</xsl:template>
</xsl:stylesheet>

posted on 2006-10-18 10:11 leoli 阅读(551) 评论(0)  编辑  收藏 所属分类: Frame


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

统计

常用链接

留言簿(6)

随笔分类

随笔档案(17)

文章分类(86)

收藏夹(3)

flex blog

good site

java blog

my friend

tools

抓虾

搜索

最新评论

阅读排行榜

评论排行榜