- From: Alex Milowski <alex@milowski.org>
- Date: Thu, 13 Apr 2006 13:03:51 -0700
- To: public-xml-processing-model-wg@w3.org
Norman Walsh wrote:
> / Alex Milowski <alex@milowski.org> was heard to say:
> | Taking the following example from Jeni Tennison's email:
> [...]
> | This means the pipeline compiler needs to understand each directed
> | syntax--including extension steps. While this adds to the implementors
> | work, I think the end result is far simpler for the user.
>
> But it makes it much more difficult for a pipeline to contain
> additional elements that can be safely ignored (extensions or
> documentation, for example).
>
> I don't see any semantic distinction between this:
>
> <p:step name="p:xslt">
> <p:input select="$document" />
> <p:input name="stylesheet" href="foo.xsl" />
> <p:output href="result.xml" />
> </p:step>
>
> and this:
>
> <p:xslt input="$document" stylesheet="foo.xsl"
> output="result.xml"/>
>
> except that you've obscured the inputs and outputs from the point of
> view of a reader and you've reduced the number of characters that have
> to be typed a little bit.
I would argue that the 'step' syntax obsures the xslt step far more.
>
> After some consideration, I think I prefer <p:step name="p:xslt"> to
> <p:xslt> and I am confident that I prefer <p:input> and <p:ouput> over
> attributes. For one thing, it means that I can do this:
>
> <p:step name="p:xslt">
> <p:input name="document">
> <doc>
> <p>Some data</p>
> </doc>
> </p:input>
Unfortuantely, that doesn't necessary map to more complex steps.
Here are two steps from my tideinfo example service [1][2]:
1. This runs a regular expression on the contents of the XHTML pre
element:
<p:regex select="h:pre" pattern=".+" matches="line"/>
2. Similarly, here is a regular expression with a step (a subpipeline)
the is run on the expression matches:
<p:regex select="line" pattern="^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)">
<p:xslt>
<xsl:transform version="1.0">
<xsl:param name="group-1"/>
<xsl:param name="group-2"/>
<xsl:param name="group-3"/>
<xsl:param name="group-4"/>
<xsl:template match="/">
<xsl:variable name="month"
select="substring-before($group-1,'/')"/>
<xsl:variable name="day"
select="substring-before(substring-after($group-1,'/'),'/')"/>
<xsl:variable name="year"
select="substring-after(substring-after($group-1,'/'),'/')"/>
<t:tide-level date="{$year}-{$month}-{$day}" level="{$group-4}">
<xsl:choose>
<xsl:when test="$group-3='EST'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-05:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='EDT'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-04:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='CST'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-06:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='CDT'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-05:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='MST'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-07:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='MDT'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-06:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='PST'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-08:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='PDT'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-07:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='AKST'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-09:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='AKDT'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-08:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='HAST'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-10:00</xsl:attribute>
</xsl:when>
<xsl:when test="$group-3='HADT'">
<xsl:attribute name="time"><xsl:value-of
select="$group-2"/>-09:00</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="time">unknown</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</t:tide-level>
</xsl:template>
</xsl:transform>
</p:xslt>
</p:regex>
I think this would get really scary in a generic syntax.
[1] http://www.smallx.com/tideinfo-service
[2] http://www.smallx.com/tideinfo
--
--Alex Milowski
Received on Thursday, 13 April 2006 20:04:17 UTC