[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: problem with creating structure
At 2007-11-11 22:05 +0100, Andreas Peter wrote:
XSL exasperates me! I have the following XML structure:
<Root>
<Textabschnitt>
<h1>Geistiger Volksbesitz der Kameruner im Blickfeld des
Missionars</h1>
<h2>EinfC<hrung </h2>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
<h2>I.Teil: Der Mensch B- ein Leib </h2>
<h3>Allgemeines </h3>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
<p>...</p>
</Textabschnitt>
</Root>
This should be transformed into the following XML structure:
<set>
<book>
<bookinfo/>
<title/>
<chapter>
<title/>
<para/>
<sect1>
<title/>
<para/>
</sect1>
<sect2>
<title/>
<para/>
</sect2>
<sect3>
<title/>
<para/>
</sect3>
</chapter>
</book>
</set>
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. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|