Re: [xsl] problem with creating structure

Subject: Re: [xsl] problem with creating structure
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Nov 2007 16:22:16 -0500
At 2007-11-11 22:05 +0100, Andreas Peter wrote:
XSL exasperates me! I have the following XML structure:

        <h1>Geistiger Volksbesitz der Kameruner im Blickfeld des
        <h2>EinfC<hrung </h2>
        <h2>I.Teil: Der &#65279;Mensch B- ein &#65279;Leib </h2>
        <h3>Allgemeines </h3>

This should be transformed into the following XML structure:


I want to insert an element <chapter> before the element <h2> but only
for the first element <h2>. The second element <h2> should be
transformed to <title>. And I need to output every <p> element
according to its proir element until the next <h2>, <h3>, ... occures.

Can you take the time to populate the target structure above with the text from your example? I'm lost as to where the content of the first <h2> goes.

And, are you restricted to XSLT 1 or can you use XSLT 2 for the solution?

Unfortunately I cannot see the problem. Any hint from the experts? I
hope this is enough code.

The code is less important than understanding the requirement. A quick look at the code is that you have gone off on a tangent and need to address the problem differently ... but that is just a guess based on not understanding what goes where. Also, your code references <h3> and <h4> but your example test data doesn't show what is happening when there are multiple occurrences of these elements in the input.

. . . . . . . . . . . . Ken

Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07
Legal business disclaimers:

Current Thread