Upload
anthony-fox
View
240
Download
1
Tags:
Embed Size (px)
Citation preview
VOFilter &
VOTable2XHTML
Chenzhou CUI, Yanxia ZHANG
China-VO Project
National Astronomical Observatory of China
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
Two XSLT transforms
VOFilter• an XML filter for OpenOffice.org Calc to open VOTable f
iles• http://services.china-vo.org/vofilter/
VOTable2XHTML• a stylesheet to transform VOTable data into HTML/XHT
ML format• http://services.china-vo.org/votable2xhtml/
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
OpenOffice.org 2• Lastest version: OpenOffice.org 2.0 Beta 2• OASIS OpenDocument XML format is used as the default file forma
t
OpenDocument• Open Document Format for Office Applications (OpenDocument) v
1.0 Specification has been approved as an OASIS Standard• 6 type of documents defined: text, drawing, presentation, spreadsh
eet, chart, image• The format will be adopted and supported by other applications and
organizations, for example, Koffice, StarOffice, European Commission, Massachusetts (US) and so on.
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
VOFilter Transform Schema
<xsl:template name=“noschema” >
<office:automatic-styles>
<xsl:call-template name="votable_styles"/>
</office:automatic-styles>
<office:body>
<xsl:call-template name="data_import"/>
</office:body>
</xsl:template>
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
<xsl:template name="data_import"><office:spreadsheet>
<!-- Transformation for each TABLE --><xsl:for-each select="//TABLE">
<xsl:call-template name="Ctable"/></xsl:for-each><!-- Transformation for each RESOURCE --><xsl:for-each select="//RESOURCE">
<xsl:call-template name="Cresource"/></xsl:for-each><!-- Transformation for the root VOTABLE --><xsl:for-each select="/VOTABLE">
<xsl:call-template name="VOTABLE"/></xsl:for-each>
</office:spreadsheet></xsl:template>
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
<!-- "TABLEDATA" level transformation --><xsl:template name="Ctable">
<xsl:if test="//DATA/TABLEDATA"><xsl:call-template name="Ctabledata"/>
</xsl:if><xsl:if test=".//FIELD">
<xsl:call-template name="Ctablefield"/></xsl:if><xsl:if test=".//PARAM">
<xsl:call-template name="Ctableparam"/></xsl:if><xsl:if test=".//GROUP">
<xsl:call-template name="Ctablegroup"/></xsl:if><xsl:call-template name="Ctableother"/>
</xsl:template>
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
<xsl:template name="Cresource"><xsl:call-template name="Cresourceparam"/><xsl:call-template name="Cresourceinfo"/><xsl:call-template name="Cresourceother"/>
</xsl:template><xsl:template name="VOTABLE">
<xsl:call-template name="VOTABLEparam"/><xsl:call-template name="VOTABLEinfo"/><xsl:call-template name="VOTABLEother"/>
</xsl:template>
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
<xsl:template match="/"><xsl:choose>
<xsl:when test="namespace-uri()"><xsl:call-template name="withschem
a"/></xsl:when><xsl:otherwise>
<xsl:call-template name="noschema"/></xsl:otherwise>
</xsl:choose></xsl:template>
This parsing schema is general enough to be used in other transform applications
Namespace Problem
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
Sheet Name Designation A VOTable file will be transformed into several sheets, sometime more
then ten, depending on the VOTable structure. Each sheet is designed a name using “ID” or “name” attribute of its originated ELEMENT. If neither “ID” or “name” is available, “TABLE”, “RESOURCE”, “VOTABLE” will be used.
TableData level• VOTID_RESID_TABID_TYPE: VOTABLE_yCat_2246_II_246_out_DA
TA RESORCE level
• VOTID_RESID_TYPE: VOTABLE_yCat_2246_Other VOTABLE level
• VOTID_TYPE: VOTABLE_INFO TYPE values include:
• DATA, FIELDS, INFO, PARAM, GROUP, Other
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
Non-supported VOTable features
Only "TABLEDATA" data content is supported. "FITS" and "BINARY" serializations are NOT supported.
Not supported VOTable elements and attributes: • Recursive "RESOURCE" elements• Recursive "GROUP" elements• "VALUES" elements for "FIELD" and "PARAM" elements• All attributes except "href" of "LINK" elements• "encoding" attribute of "TD" elements
It is almost impossible to losslessly map 3-D tree XML file onto a 2-D plain spreadsheet.
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
Some thoughts about Bruno Rino’s comments First, thank Bruno very much for his detailed test and report! A “bu
g”-fix version is under preparing. Selected comments:
• create a note (tooltip) for the "header" cells on the data spreadsheet Good Idea, “note” is supported by OpenDocument format. New version will support t
his.• Take advantage of the LINK element... create links on corresponding data cells
“LINK” is seldom used by VOTable creators, well-formed VOTables are not very common. We need think over about this feature.
Suggestion for VOTable creators: create well-formed VOTable data and files following the VOTable schema.
• Known numeric data shouldn't be loaded as text. “String” is the most accurate type, will not loss any precision. OpenOffice or Excel ha
s its own method to cope with numeric types, sometime the results are not you wanted. More suggestions are welcome on the issue......
• provide sample formulas and macros Is it out of the scope of the VOFilter? Speak frankly, I don’t understand well on how to use these functions in OpenOffice. I
will try when I have time. • LINK
http://ivoa.net/forum/votable/0509/0775.htm
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
VOTable2XHTML
Same parsing engine used with VOFilter OpenDocument “ods” elements replaced with XHT
ML tags Two versions provided: standard and basic Basic output (data and fields) is enough for most u
se.
IVOA InterOpOct2005 6-7 Oct 2005: Madrid
References
OpenDocument 1.0• http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office
OpenOffice.org• http://www.openoffice.org/