|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: "xmlns" problem for transform
I hope my filter can cope with both situations, with or without schema
assigned in one step. OpenOffice does not support multi-step filters.
(My filter and two sample xml files attached again) Regards, Michael Kay wrote: It's nothing to do with the presence or absence of a schema, it's all to do with the fact that X in namespace N is completely unrelated to X in namespace N2, or X in no namespace.
----------------- <?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> ------------------------
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








