Subject: Re: [xsl] problem with creating structure From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 11 Nov 2007 16:22:16 -0500 |
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.
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.
-- 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] problem with creating structu, Andreas Peter | Thread | Re: [xsl] problem with creating str, Andreas Peter |
[xsl] problem with creating structu, Andreas Peter | Date | Re: [xsl] problem with creating str, Andreas Peter |
Month |