Still a noobie

Here should go questions about transforming XML with XSLT and FOP.
gjledger2k
Posts: 16
Joined: Tue Aug 01, 2006 2:56 am
Location: Chicago

Still a noobie

Post by gjledger2k »

I don't get to work in XSLT all that often. I'm pretty sure I'd know how to do this transform (I have done some other successfully in the past, so I'm not completely stupid.) But...

I want to export a mac excel 2004 spreadsheet as an xml spreadsheet (easy enuff, just export an xml spreadsheet). I want to transform that into a CALS table (not using DocBook or DITA).

I'd like to use the XSLT assistant, so I can drag and drop elements and values from the xml spreadsheet to the xslt. I'm not getting:
Do I set up a transformation scenario first, and how do I do that if I haven't begun to write the xslt yet (chicken? egg?)

I have a sample CALS table that doesn't include a declaration, so I don't think there is a DTD for it, so how does that work with the scenario configuration?

Here is the xml spreadsheet:

Code: Select all


<?xml version="1.0"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Greg Ledger</Author>
<LastAuthor>Greg Ledger</LastAuthor>
<Created>2009-12-06T04:53:10Z</Created>
<Version>11.1282</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>17760</WindowHeight>
<WindowWidth>29520</WindowWidth>
<WindowTopX>8540</WindowTopX>
<WindowTopY>8660</WindowTopY>
<Date1904/>
<AcceptLabelsInFormulas/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Verdana"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s22">
<NumberFormat ss:Format="@"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="4" x:FullColumns="1" x:FullRows="1">
<Column ss:Index="2" ss:StyleID="s22"/>
<Row>
<Cell>
<Data ss:Type="String">Name</Data>
</Cell>
<Cell>
<Data ss:Type="String">Age</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">Buddy</Data>
</Cell>
<Cell>
<Data ss:Type="Number">63.0</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">Kevin</Data>
</Cell>
<Cell>
<Data ss:Type="Number">48.0</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">Alexis</Data>
</Cell>
<Cell>
<Data ss:Type="Number">40.0</Data>
</Cell>
</Row>
</Table>
<!--there's additional code but I'll just be tossing that and it is not relevant-->
and here is the CALS table doc:

Code: Select all


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Root>
<Story>
<table>
<tgroup cols="2">
<colspec colname="1"> </colspec>
<colspec colname="2"> </colspec>
<thead>
<row>
<entry>Name</entry>
<entry>Age</entry>
</row>
</thead>
<tbody>
<row>
<entry>Buddy</entry>
<entry>63</entry>
</row>
<row>
<entry>Kevin</entry>
<entry>48</entry>
</row>
<row>
<entry>Alexis</entry>
<entry>40</entry>
</row>
</tbody>
</tgroup>
</table>
</Story>
</Root>
I know where I'm going, I just need to know the best way to get there.

Thanks.
iulian_velea
Posts: 63
Joined: Fri Dec 12, 2003 6:34 pm
Contact:

Re: Still a noobie

Post by iulian_velea »

Hi,

You can create a new XSL stylesheet that will transform your spreadsheet XML document into a CALS table document and associate a transformation scenario to this new XSLT document that has set as the XML URL the file representing the spreadsheet.
So for instance, if you your XML spreadsheet is saved as "spreadsheet.xml", you can associate on your new "untitled.xsl" document a transformation scenario containing in the XML URL field the path to the "spreadsheet.xml" file. After this you should be able to drag and drop elements from the XSLT/XQuery input view into the XSL stylesheet.

Cheers,
Iulian
Post Reply