This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: possible to mimic while-like behavior?


> e.g., speaking in a Perl-esque way, I want
>   while ($foo != "bar") {
>     blah
>   }
> 
> Is there any way to simulate, hack, or otherwise achieve this?

<xsl:template match="baz">
  <xsl:call-template name="while">
    <xsl:with-param name="foo" select="$foo"/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="while">
  <xsl:param name="foo"/>
  <xsl:param name="bar"/>
  <xsl:if test="not($foo='bar')">
    <!-- begin blah -->
    <xsl:variable name="newfoo" select="maz"/>
    <!-- end blah -->
    <xsl:call-template name="while">
      <xsl:with-param name="foo" select="$newfoo"/>
    </xsl:call-template>
  </xsl:if>
</xsl:template>

   - Mike
___________________________________________________________
Mike J. Brown, software engineer, Webb Interactive Services
XML/XSL stuff: http://www.skew.org/    http://www.webb.net/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]