This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

No Subject


I've been working on this, for an embarrassingly to say how long (let's 
just say many, many, many hours), and out of desperation, and I'm making 
my first post to this mailing list, (from which I've learned a lot).    I 
have a horrible feeling that I'm approaching it in the wrong way, and 
don't have anything close to what I'm trying to do.
I am trying to transform the following xml to the result below it (which 
isn't valid xml).
A quick explanation about the structure of the xml: <hottext..> elements 
may span <par>s and be multipart, the only kind I show here.  If they are 
multipart, they have a @regionid ( regionid attriubute), and those 
@regionids will be unique within any <richtext> element.  The continuing 
portions of the <hottext..> elements are <region> elements and have the 
same @regionid.  Although this example doesn't show it, the @regionids do 
not necessarily begin with 1, and they may not be in sequential order.
I have tried using keys, call-template with param, sorting, whens, ifs, 
and gosh knows what else. Every time I'm close, there's a gotcha.
Any help would be extremely appreciated. 
Thanks, 
Marji.

The xml:
<database>
<document>
<item name='item1'>
<richtext>
 <pardef id='1'/>
  <par def='1'>
    <hottexttypeA>
      <code>code content </code>
    </hottexttypeA>
    This is the first paragraph.  The outer hottexttypeA starts
    <hottexttypeA regionid='1'>
      <code>code content </code>
      <run> here and continues into the next paragraph.</run>
    </hottexttypeA>
  </par>
  <par def='1'>
    <region regionid='1'>
      This is the second paragraph with an
      <hottexttypeB regionid='2'>
        <run> Hello, world.</run>
      </hottexttypeB>
    </region>
  </par>
  <pardef id='2'/>
  <par def='2'>
    <region regionid='1'>
      <region regionid='2'>
        <run> Goodbye, world.</run>
      </region>
      inner hottext.  The outer hottext ends here
    </region>
    and now the sentence and paragraph end.
  </par>

I'd like to apply XSL and come up with  this result which lists the 
paragraphs and hottext elements.
  <par def='1'>
     This is the first paragraph.  The outer hottexttypeA starts
      <run>
        here and continues into the next paragraph.
      </run>
  </par>
  <par def='1'>
      This is the second paragraph with an
        <run>
          Hello, world.
        </run>
  </par>
  <par def='2'>
        <run>
          Goodbye, world.
        </run>
      inner hottext.  The outer hottext ends here
    and now the sentence and paragraph end.
  </par>

<hottextTypeA regionid=1>
      <code>
        ...
      </code>
      <run>
        here and continues into the next paragraph.
      </run>
      This is the second paragraph with an
        <run>
          Hello, world.
        </run>
        <run>
          Goodbye, world.
        </run>
      inner hottext.  The outer hottext ends here
</hottextTypeA>

<hottextTypeB regionid=2>
        <run>
          Hello, world.
        </run>
        <run>
          Goodbye, world.
        </run>
</hottextTypeB>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]