[xsl] Re: Recursively link XML blocks (other)

Subject: [xsl] Re: Recursively link XML blocks (other)
From: Costantino_Sertorio@xxxxxxxxxx
Date: Tue, 27 Nov 2001 18:41:25 +0100

Thank you very much for your answer,
actually I already solved that problem, thanks to the great help of a number of
this list's subscribers (this is a great list!!).
To answer your curiosity, I'm trying to develop a "recursive document
generator". The  purpose is to store text "blocks" that will call each other,
and use them to automatically generate letters and other documents, that will be
feeded to a number of "end users". This will minimize redundancy in the document
There are a number of open issues for this: for example, the letters will have
to be modifiable after they are created.
Some ideas to solve this were:
- generate PDF (not modifiable unless by installing Acrobat), or
- generate FO and then produce RTF with JFOR (but this tool is not mature
enough), or
- generate a "flat" (non-recursive) XML and feed it to another "old-style"
program written in some other language like VB, which then generates a Word
document, or still
- generate the "flat" XML file and let the end user edit it directly, but in
order not to risk errors, the end user would have to use some strong and
supersimple WYSIWYG XML editor.

But unfortunately this will probably be out of the scope of this list!
Thank you again, and thanks to all the people that helped me with my previous


|        |          philippe drix|
|        |          <phdrix@free.|
|        |          fr>          |
|        |                       |
|        |          26.11.01     |
|        |          21:47        |
|        |                       |
  |                                                                            |
  |       To:     Costantino Sertorio/AMS/AMSINC@AMSINC                        |
  |       cc:                                                                  |
  |       Subject:     Recursively link XML blocks (other)                     |

Hello Costantino,
I have subsribed to the XSL-LIST DIGEST only, but however, I received
yesterday your post on XSLT mailing-list in my mail box, I don't know why.
I have replied to your question, but I don't know if I am granted to do
so, because I am not a plain XSL-MAILING  LIST subscriber.

Here my solution :

Costantino_Sertorio@xxxxxxxxxx wrote:
> Hello everybody,
> I am trying (without success, at the moment...) to do the following:
> XML document:
> ...
> <element_A>
>      textA textA textA
>      <insert>element_B</insert>
>      textA textA textA
> </element_A>
> <element_B>
>      textB textB textB
>      <insert>element_C</insert>
>      textB textB textB
> </element_B>
> <element_C>
>      textC textC textC
>      textC textC textC
> </element_C>
> ....etc.
> Desired output:
>      textA textA textA
>      textB textB textB
>      textC textC textC
>      textC textC textC
>      textB textB textB
>      textA textA textA

try this :
<?xml version="1.0"?>

    <xsl:output  method='text'  encoding='ISO-8859-1' />

    <xsl:template match="/">
        <xsl:call-template name="make_insert">
                <xsl:with-param name="elem" select="'element_A'" />

    <xsl:template match="insert">
        <xsl:call-template name="make_insert">
                <xsl:with-param name="elem" select="." />

    <xsl:template name="make_insert">
        <xsl:param name="elem"/>
        <xsl:for-each select="//*[name() = $elem ]" >
                <xsl:value-of select="./child::text()[1]"/>
                <xsl:value-of select="./child::text()[2]"/>

    <xsl:template match="text()"/>


Right now, I am writing a book on XSLT (in French ...), and I found your
question very interesting, but I wonder in which real context you met
this sort of problem ?

Philippe Drix

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

Current Thread