Re: Directed vs Generic Syntax

Hi Alex,

> Here are two steps from my tideinfo example service [1][2]:

Could you explain what this second step is doing:

> 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 that the XSLT transformation nested within the <p:xslt> element 
is being run with an empty source document and with the parameters 
$group-1 to $group-4 being set to the matches identified by the 
<p:regex> step. Right?

Is the regex component being passed the XSLT transformation as an input? 
Or does the <p:xslt> element represent a normal step? If the latter, 
what's the difference between embedding the <p:xslt> step within the 
<p:regex> step and linking them through the normal input/output 
channels? How does the pipeline engine know that the subexpression 
matches need to be assigned to the $group-1 to $group-4 parameters?

Currently I don't understand why you don't have the regex component 
generate an XML document that then acts as the input to a normal xslt 
step: I don't understand the point of the embedding of the xslt step. 
I'm hoping you'll enlighten me.

Thanks,

Jeni
-- 
Jeni Tennison
http://www.jenitennison.com

Received on Friday, 14 April 2006 07:37:53 UTC