xsl-list
[Top] [All Lists]

[xsl] Re: processing text nodes one character at a time

2006-09-26 18:09:48
On 9/26/06, Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com> wrote:
The original poster asked:

 How to output a specific character in front of every character in a
given string?

Part I:
====
This is a problem that is easily solved with FXSL. the solution is
this one-liner:


  f:str-map(f:flip(f:concat2(), '|'), string(/*))

Part II
====
Of course, it needs to be put into a stylesheet:


<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:f="http://fxsl.sf.net/";
xmlns:testmap="testmap"
exclude-result-prefixes="xs f"

 <xsl:import href="../f/func-str-dvc-map.xsl"/>
 <xsl:import href="../f/func-curry.xsl"/>
 <xsl:import href="../f/func-flip.xsl"/>

 <!-- To be applied on text.xml -->
 <xsl:output omit-xml-declaration="yes" indent="yes"/>

 <xsl:template match="/">
   <xsl:sequence select=
    "f:str-map(f:flip(f:concat2(), '|'), string(/*))"
    />
 </xsl:template>


and this woud be the place to put the </xsl:stylesheeet> end-tag when
the definition of the various f:concat2() functions were part of FXSL
(I'll be uploading them shortly).

And I will send the function definitions in Part III.

The reasons of this splitting of what originally was one reply is that
it never came through, regardless of three attempts -- gmail somehow
desides to use bin64 encoding, which xsl-list rejects. Sorry for the
inconvenience...

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>