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]

flat file transform (one more stupid novice question, sorry)


Hi! I am sorry for this stupid question, I've checked both XSL FAQ and Jeni's XSLT pages, but still
can not apply methods from that pages to my case. Feelin like a lobotomized flatworm. Sorry. The
problem is: I need to wrap some piece of code with <text></text> tags.

 The source for transformation is:

<?xml version="1.0" encoding="UTF-8"?>
<material xmlns:xhtml="http://www.w3.org/1999/xhtml"; xmlns:xlink="http://www.w3.org/1999/xlink";>
      <header>Material header</header>
      <subheader>Material subheader</subheader>
      <paragraph type="lead">Material lead</paragraph>
      <header2>H2 element</header2>
      <paragraph type="text">Blah blah blah <xhtml:strong>Blah blah blah</xhtml:strong>Blah blah
blah</paragraph>
      <header3>H3 element</header3>
      <paragraph type="text">Blah blah blah</paragraph>
      <theader>table header</theader>
<!-- table omitted for brevity-->
      <xhtml:table id="N400076">
        <xhtml:tr>
          <xhtml:td>
            <paragraph>
            1</paragraph>
          </xhtml:td>
        </xhtml:tr>
      </xhtml:table>
      <paragraph type="text">Blah blah blah</paragraph>
      <commentaryheader>Header of a commentary</commentaryheader>
      <paragraph type="commentary">commentary</paragraph>
      <paragraph type="commentary">commentary</paragraph>
      <paragraph type="text">blah blah</paragraph>

      <paragraph type="author"><link xlink:type="simple" href="mailto:morpheus@basko.ru";
xlink:show="replace">Philipp</link></paragraph>
      <paragraph type="source">By<link xlink:type="simple" href="http://www.lenta.ru/";
xlink:show="replace">lenta.ru</link>.</paragraph>
</material>


All I need is to wrap all p[@type='text'], h2, h3, commentary with <text></text> tags. The problem
is that everything - table, commentary should also be placed inside <text> tag in an appropriate
order. In other words, the structure should be very simple:
<material>
<header></header>
<subheader></subheader>
<lead></lead>
<text>
 <paragraph></paragraph>
 <h2></h2> <!-- //if there is any in any order-->
 <h3></h3> <!-- //if there is any-->
 <table></table> <!-- //if there is any-->
 <paragraph></paragraph>
 <commentary>
   <header></header>
   <text>
      <paragraph></paragraph>
      <paragraph></paragraph>
  </text>
 </commentary>
</text>
<author></author>
<source></source>
</material>

I feel that it could be made in a very simple way, but do not see, how :( sorry for a stupid
question once again. Please, help me.

Philipp.
P.S. or, maybe, I should use one stylesheet to process everything except <text></text> and another
to process all <text> stuff??? still no good idea... :(


 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]