W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > November 2007

Re: A small stress test

From: Innovimax SARL <innovimax@gmail.com>
Date: Fri, 30 Nov 2007 19:56:44 +0100
Message-ID: <546c6c1c0711301056r2a2cefc5o427918d914b273e4@mail.gmail.com>
To: "Richard Tobin" <richard@inf.ed.ac.uk>
Cc: public-xml-processing-model-wg@w3.org
Sorry,

It looks to me more an XSLT stress test, isn'it ?

Mohamed

On Nov 30, 2007 7:40 PM, Richard Tobin <richard@inf.ed.ac.uk> wrote:

>
> The pipeline below computes Ackermann's function.  For example,
> given the input file
>
>  <a><m>3</m><n>1</n></a>
>
> it produces the output
>
>  <x>13</x>
>
> Given the input
>
>  <a><m>3</m><n>2</n></a>
>
> it should produce
>
>  <x>29</x>
>
> but with my implementation produces "fork: Resource temporarily
> unavailable".
>
> <p:pipeline name="ackermann" xmlns:p="http://www.w3.org/ns/xproc">
>
> <p:input port="in"/>
> <p:output port="out"/>
>
> <p:xslt name="transform">
>  <p:input port="stylesheet">
>    <p:inline>
>
> <xsl:stylesheet version="1.0" xmlns:xsl="
> http://www.w3.org/1999/XSL/Transform">
>  <xsl:template match="node()">
>    <xsl:copy>
>      <xsl:apply-templates select="node()"/>
>    </xsl:copy>
>  </xsl:template>
>
>  <xsl:template match="a[.//a]" priority="10">
>    <xsl:copy>
>      <xsl:apply-templates select="node()"/>
>    </xsl:copy>
>  </xsl:template>
>
>  <xsl:template match="a[m=0]">
>    <x>
>      <xsl:value-of select="n + 1"/>
>    </x>
>  </xsl:template>
>
>  <xsl:template match="a[m>0 and n=0]">
>    <a>
>      <m><xsl:value-of select="m - 1"/></m>
>      <n>1</n>
>    </a>
>  </xsl:template>
>
>  <xsl:template match="a[m>0 and n>0]">
>    <a>
>      <m><xsl:value-of select="m - 1"/></m>
>      <n>
>        <a>
>          <m><xsl:value-of select="m"/></m>
>          <n><xsl:value-of select="n - 1"/></n>
>        </a>
>      </n>
>    </a>
>
>  </xsl:template>
> </xsl:stylesheet>
>
>    </p:inline>
>  </p:input>
> </p:xslt>
>
> <p:choose name="choose">
>  <p:when test="//a" name="when">
>    <ackermann name="rec-ack"/>
>  </p:when>
>  <p:otherwise name="otherwise">
>    <p:identity name="identity"/>
>  </p:otherwise>
> </p:choose>
>
> </p:pipeline>
>
> -- Richard
>
>


-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 9 52 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 
Received on Friday, 30 November 2007 18:57:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:54 GMT