[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Streaming Transformations for XML
I'm playing with an idea of a streaming transformation language. I don't mean things like forward-only streamable subsets of XSLT or building subtrees on request only, but an alternative language designed for streaming transformations. From a bit different point of view, it would be a language to define SAX filters. Such a hypothetic languge (let me call it STX) could use an XML, XSLT-like syntax with templates. However, the meaning of templates would be quite different from this of XSLT. Matching expressions could consists of SAX-related axes and simple, XPath-like identifier, for example. STX transformations will be, of course, much less powerful than XSLT; it will be as powerful as a SAX filter can be. On the other hand, the new language could provide an memory inexpensive way to handle simplier transformation. Instead of a BNF definition, I append an example processed by non-existing STX processor. It should provide you with some very basic feeling about a possible syntax and semantics of the language. I wonder whether the benefits of having simple streaming transformations worth to learn a new language (and to implement a processor). Also, I haven't been able to find a similar solution or idea on the Net, but I expect there must a similar effort in the huge XML community. So, any pointers are welcome to prevent me from reinventing the wheel. Regards, Petr -------------- * Example ** Transformation: <stx:transform xmlns:stx="some_namespace_here"> <stx:variable name="date" select="'Monday'"/> <stx:template match="element-start::list"> <stx:copy-of attributes="all"> <stx:attribute name="date" select="$date"/> </stx:copy-of> </stx:template> <stx:template match="element-end::list"> <stx:copy-of/> </stx:template> <stx:template match="element-start::item"> <stx:copy-of/> <id><stx:value-of select="@id"/></id> <stx:if test="@id=2"> <note>the item we have been looking for</note> </stx:if> </stx:template> <stx:template match="element-end::item"> <date><stx:value-of select="$date"/></date> <stx:copy-of/> </stx:template> <stx:template match="character::*"> <text><stx:copy-of/></text> </stx:template> </stx:transform> ** Input data: <list id="19"> <item id="1">A</item> <item id="2">B</item> <item id="3">C</item> </list> ** Output: <list id="19" date="Monday"> <item> <id>1</id> <text>A</text> <date>Monday</date> </item> <item> <id>2</id> <note>the item we have been looking for</note> <text>B</text> <date>Monday</date> </item> <item> <id>3</id> <text>C</text> <date>Monday</date> </item> </list> -- Petr Cimprich Ginger Alliance www.gingerall.com
|
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
|