[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] RE: br elements to root


Subject: [xsl] RE: br elements to root
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Fri, 03 Jun 2005 18:19:58 +0000

Jon, you're welcome FWIW, but in XSL's defense it *is* useful for a variety of declarative transforms that would be much, much harder to do in imperative fashion. People more experienced than I may comment on this and, perhaps, provide an XSL solution where I could not, offhand.

However, I have a question: your original post had this input:

<p>
 <strong>
   strong:text(top) <br/>prefix
     <span style="a style">
       span a
       <span style="rgb();">
         span b<br/> text
       </span>
       text
      </span>
   strong:text(btm) <br/>suffix<br/>
 </strong>
 Root level text with<br/> tag.
</p>

To be transformed to this output:

<p>
 <strong>
   strong:text(top)
 </strong>
 <br/>
 <strong>
   prefix
   <span style="a style">
     span a
     <span style="rgb();">
       span b
     </span>
   </span>
 </strong>
 <br/>
 <strong>
   <span>
     <span>
      text
     </span>
     text
   </span>
   strong:text(btm)
 </strong>
 <br/>
 <strong>
   suffix
 </strong>
 <br/>
 <strong>
 </strong>
 Root level text with
 <br/>
  tag.
</p>

My question is, how did you derive the

 <strong>
 </strong>

near the end?


If going through this mentally I would expect to close </strong> after the penultimate <br/>, and then not open-close a <strong> because it's not readily apparent that it's needed. Except, of course, if you were creating the output (above) in lexical fashion -- closing opening tags and opening closing tags. (In which case you were already at the procedural solution, of course).


Regards,


--A

From: jpk <jopaki@xxxxxxxxx>
Sir,

I want to thank you for your very helpful input.  I
ended up doing just this - but in Java.  I don't think
XSL has the "easy" ability to do such a task since its
notion of an "element" is not the element itself
rather itself AND its children along with its matching
end tag.  I don't really find XSL very useful and am
dismayed by it.

Jon

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



Current Thread
Keywords
xsl