Still a noobie

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

Still a noobie

Post by gjledger2k » Tue Dec 08, 2009 6:37 am

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:x="urn:schemas-microsoft-com:office:excel" xmlns:html=""
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Greg Ledger</Author>
<LastAuthor>Greg Ledger</LastAuthor>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Font ss:FontName="Verdana"/>
<Style ss:ID="s22">
<NumberFormat ss:Format="@"/>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="4" x:FullColumns="1" x:FullRows="1">
<Column ss:Index="2" ss:StyleID="s22"/>
<Data ss:Type="String">Name</Data>
<Data ss:Type="String">Age</Data>
<Data ss:Type="String">Buddy</Data>
<Data ss:Type="Number">63.0</Data>
<Data ss:Type="String">Kevin</Data>
<Data ss:Type="Number">48.0</Data>
<Data ss:Type="String">Alexis</Data>
<Data ss:Type="Number">40.0</Data>
<!--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"?>
<tgroup cols="2">
<colspec colname="1"> </colspec>
<colspec colname="2"> </colspec>
I know where I'm going, I just need to know the best way to get there.


Posts: 63
Joined: Fri Dec 12, 2003 6:34 pm

Re: Still a noobie

Post by iulian_velea » Tue Dec 08, 2009 12:15 pm


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.


Post Reply