Matthew Monkan wrote:
Alright, I'm really close to getting this application to work but am stumped
over one thing.

Here is my initial XML file:

<?xml version="1.0"?>
<execute-query xmlns="http://apache.org/cocoon/SQL/2.0";>
  <query>SELECT test_data from test_table;</query>
</execute-query>

It gets passed through the SQL transformer and produces this XML:

<rowset>
  <row>
    <test_data>Puffball</test_data>
  </row>
</rowset>

Are you sure this is the exact XML output of the SQLTransformer stage? I'm surprised there is no namespace declaration. The docs indicate this output should be in the http://apache.org/cocoon/SQL/2.0 namespace, in which case you'll need to adjust your XSLT to target the namespaced nodes.

If you're viewing the XML in Firefox, make sure you do a View Source on it; FF's pretty XML tree view does not show namespaces if I recall.


Okay, so now I just need to select Puffball from test_data and wrap it with
XML that the HSSFSerializer likes. This is the XSL I use:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">

<gmr:Workbook xmlns:gmr="http://www.gnome.org/gnumeric/v7";>
  <gmr:SheetNameIndex>
    <gmr:SheetName>Sheet1</gmr:SheetName>
  </gmr:SheetNameIndex>
  <gmr:Sheets>
    <gmr:Sheet>
      <gmr:Name>Sheet1</gmr:Name>
      <gmr:MaxCol>-1</gmr:MaxCol>
      <gmr:MaxRow>-1</gmr:MaxRow>
      <gmr:Cells>
        <gmr:Cell Col="1" Row="1" ValueType="60">
            <xsl:value-of select="/rowset/row/test_data[1]" />
        </gmr:Cell>
      </gmr:Cells>
    </gmr:Sheet>
  </gmr:Sheets>
</gmr:Workbook>

</xsl:template>
</xsl:stylesheet>

However, after the transformation I get this XML:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/">

<gmr:Workbook xmlns:gmr="http://www.gnome.org/gnumeric/v7";>
  <gmr:SheetNameIndex>
    <gmr:SheetName>Sheet1</gmr:SheetName>
  </gmr:SheetNameIndex>
  <gmr:Sheets>
    <gmr:Sheet>
      <gmr:Name>Sheet1</gmr:Name>
      <gmr:MaxCol>-1</gmr:MaxCol>
      <gmr:MaxRow>-1</gmr:MaxRow>
      <gmr:Cells>
        <gmr:Cell Col="1" Row="1" ValueType="60">
            <gmr:Cell ValueType="60" Row="1" Col="1"/>
        </gmr:Cell>
      </gmr:Cells>
    </gmr:Sheet>
  </gmr:Sheets>
</gmr:Workbook>

</xsl:template>
</xsl:stylesheet>

Notice that the <xsl:value-of select="/rowset/row/test_data[1]" /> statement
retrieved <gmr:Cell ValueType="60" Row="1" Col="1"/>

That output makes no sense, I can't imagine any reason it would be duplicating the element. Is this a direct copy-paste of the output, or is it possible there's just one empty gmr:Cell element and the duplication was a copy-paste mistake?


?!?!

My thoughts exactly. ;)


Why did it return a copy of the Cell element and not Puffball? :,(


- Matt


------------------------------------------

Robin Wyles wrote:
I think there is an error in your xsl here:

<xsl:value-of select="/Workbook/Sheets/Sheet/Cells/Cell/rowset/row/ test_data/[1]" />

Should be...

<xsl:value-of select="/Workbook/Sheets/Sheet/Cells/Cell/rowset/row/ test_data[1]" />

You don't use a slash before declaring a predicate.

Cheers,

Robin



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to