xsl-list
[Top] [All Lists]

Re: [xsl] Rusty at XSLT, need help ("Oil can!, Oil can!")

2010-04-26 16:12:41

I am trying to extract the text from particular elements in an Excel workbook 
which has been saved to XML format. The structure, in short, is this:

<Workbook>
 <DocumentProperties/>
 <ExcelWorkbook/>
  <Worksheet>
     <Names/>
       <Table>
          <Column/>
          <Row>
             <Cell/>
             <Cell/>
             <Cell>
                <Data>Randolph</Data>
                <NamedCell/>
             </Cell>
          </Row>
       </Table>
        <WorksheetOptions/>
  </Worksheet>
</Workbook>

There is at least one <Worksheet> Element.

So here I am thinking, "This should be easy. Start with selecting the text of 
the first cell in the first row on the first worksheet."

So I use this XSLT:

<?xml version="1.0"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">

               <xsl:template match="/">
                       <xsl:value-of 
select="Workbook/Worksheet[1]/Table/Row[3]/Data" />
               </xsl:template>
</xsl:stylesheet>

thinking that the output will be "Randolph" because I can see  that in the 
source document . But no, the only output I get is the XML document 
declaration!

Please someone have pity on a fallen-away XSLT programmer trying to be in the 
good graces of the W3C.


You have

/Table/Row[3]

but you really meant

/Table/Row/Cell[3]


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--