[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Streaming Transformations for XML

  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Subject: Streaming Transformations for XML
  • From: Petr Cimprich <petr@g...>
  • Date: Wed, 13 Feb 2002 14:43:17 +0100
  • User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011226

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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.