xsl-list
[Top] [All Lists]

[xsl] process xslt and xml spreadsheet via web browser

2014-09-12 06:53:17
Subscribers,

For those unaware, Gnumeric is an Xml-based spreadsheet (see below, edited for brevity).

The objective is to use a web browser to transform the xml spreadsheet file into text output (\t=keyboard tab), i.e.:

text test1 \t other textx \t 100
text test2 \t other texty \t 200
text test2 \t other texty \t 700
text test2 \t other texty \t 300
text test2 \t other texty \t 250
text test3 \t other textz \t 400

An Xslt file was created:

<?xml version="1.0"?>
<xsl:stylesheet
        version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns='http://www.w3.org/1999/xhtml'>
        <xsl:output
                method="text"
                encoding="utf-8"
                indent="no"
                omit-xml-declaration="yes"
                media-type="text/plain"
                standalone="yes"
                />
        <xsl:template match='Cells'>
                <xsl:apply-templates select='Cell'/>
        </xsl:template>
</xsl:stylesheet>

The Jedit text editor was used with the plugin XLST processor (uses Xalan Java), which produces the text file (below). Why does the text file contain text from nodes outside the nodes 'Cells' and 'Cell'?




      4
      WorkbookView::show_horizontal_scrollbar
      TRUE


      4
      WorkbookView::show_vertical_scrollbar
      TRUE


      4
      WorkbookView::show_notebook_tabs
      TRUE


      4
      WorkbookView::do_auto_completion
      TRUE


      4
      WorkbookView::is_protected
      FALSE




      2014-09-12T09:56:44Z
      2014-09-12T09:53:41Z




    Sheet1
    Sheet2
    Sheet3




      Sheet1
      2
      6
      1


          Print_Area
          #REF!
          A1


          Sheet_Title
          "Sheet1"
          A1




















        d_then_r
        portrait


        iso_a4




            Sans













        columnnamea
        columnnameb
        columnnamec
        text test1
        other textx
        100
        text test2
        other texty
        200
        text test2
        other texty
        700
        text test2
        other texty
        300
        text test2
        other texty
        250
        text test3
        other textz
        400





      Sheet2
      -1
      -1
      1


          Print_Area
          #REF!
          A1


          Sheet_Title
          "Sheet2"
          A1




















        d_then_r
        portrait


        iso_a4




            Sans













      Sheet3
      -1
      -1
      1


          Print_Area
          #REF!
          A1


          Sheet_Title
          "Sheet3"
          A1




















        d_then_r
        portrait


        iso_a4




            Sans















Gnumeric Xml file (named test.gnumeric in the Xhtml further below):

<?xml version="1.0" encoding="UTF-8"?>
<!--attempted to add a stylesheet but unable to view transformed document in web browser
<?xml-stylesheet type="text/xsl" href="testgnumeric.xslt"?>
-->
<gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.gnumeric.org/v9.xsd";>
  <gnm:Version Epoch="1" Major="10" Minor="2" Full="1.10.2"/>
  <gnm:Attributes>
    ...
  </gnm:Attributes>
  <office:document-meta
        ...
  </office:document-meta>
<gnm:Calculation ManualRecalc="0" EnableIteration="1" MaxIterations="100" IterationTolerance="0.001" FloatRadix="2" FloatDigits="53"/>
  <gnm:SheetNameIndex>
    ...
  </gnm:SheetNameIndex>
  <gnm:Geometry Width="1080" Height="586"/>
  <gnm:Sheets>
<gnm:Sheet DisplayFormulas="0" HideZero="0" HideGrid="0" HideColHeader="0" HideRowHeader="0" DisplayOutlines="1" OutlineSymbolsBelow="1" OutlineSymbolsRight="1" Visibility="GNM_SHEET_VISIBILITY_VISIBLE" GridColor="0:0:0">
      <gnm:Name>Sheet1</gnm:Name>
      <gnm:MaxCol>2</gnm:MaxCol>
      <gnm:MaxRow>6</gnm:MaxRow>
      <gnm:Zoom>1</gnm:Zoom>
      <gnm:Names>
        <gnm:Name>
          ...
        </gnm:Name>
      </gnm:Names>
      <gnm:PrintInformation>
        ...
      </gnm:PrintInformation>
      <gnm:Styles>
        ...
      </gnm:Styles>
      <gnm:Cols DefaultSizePts="48">
        <gnm:ColInfo No="0" Unit="48" Count="3"/>
      </gnm:Cols>
      <gnm:Rows DefaultSizePts="12.75">
        <gnm:RowInfo No="0" Unit="13.5" Count="7"/>
      </gnm:Rows>
      <gnm:Selections CursorCol="0" CursorRow="0">
        <gnm:Selection startCol="0" startRow="0" endCol="0" endRow="0"/>
      </gnm:Selections>
      <gnm:Cells>
        <gnm:Cell Row="0" Col="0" ValueType="60">columnnamea</gnm:Cell>
        <gnm:Cell Row="0" Col="1" ValueType="60">columnnameb</gnm:Cell>
        <gnm:Cell Row="0" Col="2" ValueType="60">columnnamec</gnm:Cell>
        <gnm:Cell Row="1" Col="0" ValueType="60">text test1</gnm:Cell>
        <gnm:Cell Row="1" Col="1" ValueType="60">other textx</gnm:Cell>
        <gnm:Cell Row="1" Col="2" ValueType="40">100</gnm:Cell>
        <gnm:Cell Row="2" Col="0" ValueType="60">text test2</gnm:Cell>
        <gnm:Cell Row="2" Col="1" ValueType="60">other texty</gnm:Cell>
        <gnm:Cell Row="2" Col="2" ValueType="40">200</gnm:Cell>
        <gnm:Cell Row="3" Col="0" ValueType="60">text test2</gnm:Cell>
        <gnm:Cell Row="3" Col="1" ValueType="60">other texty</gnm:Cell>
        <gnm:Cell Row="3" Col="2" ValueType="40">700</gnm:Cell>
        <gnm:Cell Row="4" Col="0" ValueType="60">text test2</gnm:Cell>
        <gnm:Cell Row="4" Col="1" ValueType="60">other texty</gnm:Cell>
        <gnm:Cell Row="4" Col="2" ValueType="40">300</gnm:Cell>
        <gnm:Cell Row="5" Col="0" ValueType="60">text test2</gnm:Cell>
        <gnm:Cell Row="5" Col="1" ValueType="60">other texty</gnm:Cell>
        <gnm:Cell Row="5" Col="2" ValueType="40">250</gnm:Cell>
        <gnm:Cell Row="6" Col="0" ValueType="60">text test3</gnm:Cell>
        <gnm:Cell Row="6" Col="1" ValueType="60">other textz</gnm:Cell>
        <gnm:Cell Row="6" Col="2" ValueType="40">400</gnm:Cell>
      </gnm:Cells>
      <gnm:SheetLayout TopLeft="A1"/>
<gnm:Solver ProblemType="0" MaxTime="30" MaxIter="100" NonNeg="1" Discr="0" AutoScale="0" ProgramR="0"/>
    </gnm:Sheet>
  </gnm:Sheets>
  <gnm:UIData SelectedTab="0"/>
</gnm:Workbook>

An Xhtml file was created (below): is it possible to use a web browser to perform the transformation, via linking to both the Xslt and Xml files?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd";>
        <html xmlns='http://www.w3.org/1999/xhtml' lang='en' xml:lang='en'>
                <head>
                        <title>spreadsheet transformation</title>
<link rel="stylesheet" type="application/xslt+xml" href="testgnumeric.xslt" media="screen"/> <link rel='stylesheet' href='styles.css' type='text/css' media='screen' />
                </head>
                <body>
                        <form
                                action="test.gnumeric"
                                method='post'
                                name=''
                                >
                                <p>
                                        <select
                                                name=''
                                                >
                                                <option>
                                                        ...
                                                </option>
                                        </select>
                                        <input
                                                type="submit"
                                                value='send'
                                                />
                                </p>
                        </form>
                </body>
        </html>
        <!--

        -->
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>