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

RE: Streaming Transformations for XML

  • To: XMLDEV <xml-dev@l...>
  • Subject: RE: Streaming Transformations for XML
  • From: Jandia Cyril <cjandia@l...>
  • Date: Thu, 14 Feb 2002 12:29:48 +0100
  • Importance: Normal
  • In-reply-to: <3C6A8430.8020702@d...>

stx template

Hi again Petr ;o) - Hi all,

> From: Petr Cimprich <petr@g...>
> To: "'xml-dev@l...'" <xml-dev@l...>
> Subject:  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/

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.