Re: [xsl] What is the Core of XSLT?

Subject: Re: [xsl] What is the Core of XSLT?
From: "Abel Braaksma (Exselt)" <abel@xxxxxxxxxx>
Date: Sun, 30 Mar 2014 03:46:29 +0200
On 30-3-2014 3:07, Dimitre Novatchev wrote:
>  I am glad that you will be happy:  :)

Yes I am, and a bit blushing now ;)

> Do you see any <xsl:choose> or <xsl:if> in the code below?
>
>  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
>  <xsl:output method="text"/>
>
>  <xsl:param name="left"  select="3"/>
>  <xsl:param name="right"  select="2"/>
>  <xsl:param name="operator" select="'*'" />
>  <xsl:template match="/">
>    <xsl:call-template name="calculator2"/>
>  </xsl:template>
>
>  <xsl:template name="calculator2">
>      <xsl:apply-templates select="self::node()[$operator = '*']" mode="mult"/>
>      <xsl:apply-templates select="self::node()[$operator = '+']" mode="add"/>
>      <xsl:apply-templates select=
>      "self::node()[not($operator = '+') and not($operator = '*') ]"
> mode="error"/>
>  </xsl:template>

So simple! I hate it that I didn't think of that myself :). Creative
programming, and still elegant, very nice!

And in the event that there is no initial node (which only happens in
2.0+), you can always create one.

I assume you would come up with similarly simple solutions to solve for
instance searching for a string in a string and returning its positions
or occurrences. At the very minimal, I thing you would need something
like codepoints-to-string and its reverse, or substring, or a variant
thereof, which would probably be enough to add that machinery.

Cheers & thanks,

Abel Braaksma
Exselt XSLT 3.0 processor
http://exselt.net

Current Thread