[
Lists Home |
Date Index |
Thread Index
]
- To: XMLDEV <xml-dev@lists.xml.org>
- Subject: RE: [xml-dev] Streaming Transformations for XML
- From: Jandia Cyril <cjandia@logfi.fr>
- Date: Thu, 14 Feb 2002 12:29:48 +0100
- Importance: Normal
- In-reply-to: <3C6A8430.8020702@dyomedea.com>
Hi again Petr ;o) - Hi all,
> From: Petr Cimprich <petr@gingerall.cz>
> To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
> Subject: [xml-dev] Streaming Transformations for XML
>
> I'm playing with an idea of a streaming transformation language.
> [...]
> Petr Cimprich
> Ginger Alliance
> www.gingerall.com
Making the assumption STX will be useful on its own (as soon as precisely
described :-) here are some "day after" thoughts (in no particular order)
about it - in the hope of helping it, while keeping it as simple as it
is/possible :
I have a problem with your "stx:copy-of" operator.
Don't you think it would be quite difficult to give it precise and simple
semantics if you let it as it is now? I mean : under the form of an
**element**.
What's the point? Well, as I understand it now, it is free to appear (or
not) at beginning/end of a stx:template's child list. So, what happens if
you omit it in either of these template occurrences :
<stx:template match="element-start::an-element-type">
<stx:copy-of/>
...
</stx:template>
and
<stx:template match="element-end::an-element-type">
...
<stx:copy-of/>
</stx:template>
Then, I foresee you'll have to add many usage conditions for
restricting/controlling its appearance in context, in order for it to have
determistic effect, won't you?
Thus, I guess it would be more unambiguous to re-introduce it (from its
STX-transform-operator nature point of view) as an attribute : copy="yes|no"
;
now here's your transform sample, back, in STX, say "version 0.2" (which is
shorter/simpler) :
<stx:transform xmlns:stx="some_namespace_here">
<stx:variable name="date" select="'Monday'"/>
<stx:template match="element-start::list" copy="yes"
copy-attributes="all">
<stx:attribute name="date" select="$date"/>
</stx:template>
<stx:template match="element-start::item" copy="yes">
<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:template>
<!-- and why not RegExp, BTW ?
("$1" in "<stx:value-of select..." gets its value from the regexp pattern
(in parenthesis) of
"<stx:template match='...'") -->
<stx:template match="character::(.*)">
<text><stx:value-of select="$1"/></text>
</stx:template>
</stx:transform>
Also, what do you think of this RegExp idea ? I like it.
But, am I not off topic (concerning envisioned STX simplicity) ?
PS :
Finally, I propose to add the following to your list of "SAX axes" :
"after-element-start::" (as a synonym of "element-start::"),
"before-element-end::" (as a synonym of "element-end::"),
and "before-element-start::", "after-element-end::" (for completeness).
Does all that make sense ?
Regards,
Cyril Jandia
http://www.cjandia.com/
Author of ESPX/TinyXSL
http://www.cjandia.com/2001/espx-tinyxsl/
|