Re: [xml] transformation of any format in xml




On 15/10/2006, at 12:32 AM, Sema wrote:


Hi,

I know that we can use XSLT to transform a data flow from XML to any other format. But how can I transform NON-XML to XML? XSLT does not function in
that case.

Thanks!


I have written a command line program for converting any structured text into xml, it takes an xml file contain instructions on how to use regular expression to generate XML, I use it to take source code comments use it to generate XML, like JavaDoc, AutoDoc, HeaderDoc, etc, though it is much more generic than that. I initially developed it in Objective-C, but I am in the process of rewriting it in C++ using libxml so it will be portable and plan to make it public.

This is an example of a xml document used to process, tab separated values.

<ftx:translator root-template="document" version="1.0" xmlns:ftx="http://homepage.mac.com/nathan_day/formated-text-to-xml";>
        <ftx:template name="document">
                <document>
                        <file-name href="$file-url">
                                <ftx:text select="$file-name"/>
                        </file-name>
                        <ftx:match pattern="^.+$">
                                <ftx:call-template name="row" select="$0"/>
                        </ftx:match>
<ftx:comment>Generated from the source <ftx:text select="$0"/></ ftx:comment>
                </document>
        </ftx:template>
        
        <ftx:template name="row">
                <row>
                        <ftx:match select="$0" pattern="[^\t]+">
                                <data>
                                        <ftx:text select="$0"/>
                                </data>
                        </ftx:match>
                </row>
        </ftx:template>
</ftx:translator>






--
View this message in context: http://www.nabble.com/transformation- of-any-format-in-xml-tf2442851.html#a6811185 Sent from the Gnome - Lib - Xml - General mailing list archive at Nabble.com.

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]