[xsl] "xmlns" problem for transform

Subject: [xsl] "xmlns" problem for transform
From: Chenzhou Cui <ccz@xxxxxxxxx>
Date: Thu, 04 Aug 2005 03:02:56 +0800
Dear xsl-list,

I compiled an XSLT filter for OpenOffice to transform VOTable
(http://www.ivoa.net/Documents/REC/VOTable/VOTable-20040811.html) files
into OpenOffice Calc spreadsheet.

The filter and two sample files are attached. The filter works well with
the VOTable file without "schema" assigned. However, it can't transform
the body of sample file with "schema" assigned.

Please help me to solve the problem and let me know the reason. Thank
you very much!

Cheers,

--
============================================================
Chenzhou Cui  (China-VO project)
National Astronomical Observatory | Tel: (8610)64841695
Chinese Academy of Sciences       | FAX: (8610)64878240
20A Datun Road, Chaoyang District | Email: ccz@xxxxxxxxx
Beijing 100012, China             | WWW: www.lamost.org/~cb
============================================================

simple.xml
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<VOTABLE>
<RESOURCE>
<TABLE>
<FIELD name="RA" datatype="float"></FIELD>
<FIELD name="DEC" datatype="float"/>
<DATA>

	<TABLEDATA>
<TR>
	<TD>26.47</TD><TD>25.6</TD>
</TR>
<TR>
	<TD>8.9</TD><TD>0.7</TD>
</TR>	
	</TABLEDATA>
</DATA>
</TABLE>
</RESOURCE>
</VOTABLE>

----------------------
simple_schema.xml
----------------------
<?xml version="1.0" encoding="UTF-8"?>
<VOTABLE ID="test" version="1.1" xmlns="http://www.ivoa.net/xml/VOTable/v1.1"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.ivoa.net/xml/VOTable/v1.1
VOTable-1.1.xsd">
<RESOURCE>
<TABLE>
<FIELD name="RA" datatype="float"/>
<FIELD name="DEC" datatype="float"/>
<DATA>
<TABLEDATA>
<TR>
<TD>26.47</TD>
<TD>25.6</TD>
</TR>
<TR>
<TD>8.9</TD>
<TD>0.7</TD>
</TR>
</TABLEDATA>
</DATA>
</TABLE>
</RESOURCE>
</VOTABLE>


--------------------
myfilter.xslt
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by SLY (BJUT) -->
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by wukui (CALT) -->


<xsl:stylesheet version="1.0" office:class="spreadsheet" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:html="http://www.w3.org/TR/REC-html40"; xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:dom="http://www.w3.org/2001/xml-events"; xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML"; xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:ooo="http://openoffice.org/2004/office"; xmlns:oooc="http://openoffice.org/2004/calc"; xmlns:ooow="http://openoffice.org/2004/writer"; xmlns="http://www.ivoa.net/xml/VOTable/v1.1";>
<xsl:output method="xml" encoding="UTF-8" version="1.0" indent="yes"/>
<xsl:template match="/">
<xsl:comment>Generated by TOTable2ods V1.0 (China-VO)</xsl:comment>
<office:document-content office:mimetype="application/x-vnd.oasis.openoffice.spreadsheet" office:version="1.0">


<office:automatic-styles>
<xsl:call-template name="votable_styles"/>
</office:automatic-styles>
<office:body>
<xsl:for-each select="/VOTABLE">
<xsl:call-template name="data_import"/>
</xsl:for-each>
</office:body>
</office:document-content>
</xsl:template>
<xsl:template name="votable_styles">
<style:style style:name="co1" style:family="table-column">
<style:properties fo:break-before="auto" style:column-width="Default"/>
</style:style>
<style:style style:name="ro1" style:family="table-row">
<style:properties style:row-height="Default" fo:break-before="auto" style:use-optimal-row-height="true"/>
</style:style>
<style:style style:name="ta1" style:family="table" style:master-page-name="Default">
<style:properties table:display="true"/>
</style:style>
<style:style style:name="header" style:family="table-cell" style:parent-style-name="Default">
<style:table-cell-properties style:text-align-source="fix" style:repeat-content="false"/>
<style:paragraph-properties fo:text-align="center" fo:margin-left="0cm"/>
<style:text-properties fo:color="#4700b8" style:font-name="Arial" fo:font-style="normal" fo:font-weight="bold" style:font-style-asian="italic"/>
</style:style>
</xsl:template>
<xsl:template name="data_import">
<office:spreadsheet>
<table:table table:name="DATA" table:style-name="ta1" table:print="false">
<table:table-row table:style-name="ro1">


<xsl:for-each select="//RESOURCE/TABLE/FIELD">
<xsl:choose>
<xsl:when test="@name">
<table:table-cell table:style-name="header" office:value-type="string">
<text:p>
<xsl:value-of select="@name"/>
</text:p>
</table:table-cell>
</xsl:when>
<xsl:otherwise>
<table:table-cell table:style-name="header" office:value-type="string">
<text:p>
<xsl:value-of select="@ID"/>
</text:p>
</table:table-cell>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table:table-row>
<xsl:for-each select="//RESOURCE/TABLE/DATA">
<xsl:for-each select="TABLEDATA">
<xsl:for-each select="TR">
<table:table-row table:style-name="ro1">
<xsl:for-each select="./TD">
<table:table-cell>
<text:p>
<xsl:value-of select="."/>
</text:p>
</table:table-cell>
</xsl:for-each>
</table:table-row>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</table:table>
</office:spreadsheet>
</xsl:template>

</xsl:stylesheet>
------------------------


Current Thread