[
Lists Home |
Date Index |
Thread Index
]
Interesting. Looks to like XSLT-- or AFs++. I think this
is worth pursuing further.
Lately, I've realised that while we've got a nice collection of
schema languages, there's not a great deal to choose from in
other areas (except tree models perhaps). So exploring other
kinds of transformation mechanisms seems like a good thing
to me.
I can see this being particularly useful when written as
a Cocoon Transformer.
L.
> -----Original Message-----
> From: Petr Cimprich [mailto:petr@gingerall.cz]
> Sent: 13 February 2002 13:43
> To: 'xml-dev@lists.xml.org'
> Subject: [xml-dev] 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
>
>
>
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
>
> The list archives are at http://lists.xml.org/archives/xml-dev/
>
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>
|