[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Aw:  How to collect the content of the inline siblings

Subject: Aw:  How to collect the content of the inline siblings into a single element.
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 28 Dec 2024 05:03:40 -0000
Aw:  How to collect the content of the  inline siblings
With XSLT 2 or higher, in a template matching "*[strong]", use eg
<xsl:for-each-group select="*" group-adjacent="boolean(self::strong)">,
check the current-grouping-key() inside with xsl:choose/when to output a
single strong element if it is true and populate by processing the child
nodes of the current-group(), otherwise just process the current group,
with the identity transformation set up

--
Gesendet mit der GMX Mail App

Am 28.12.24, 05:26 schrieb "Rajagopal CV cvr3@xxxxxxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>:

  Kindly assist me with an XSL code needed to generate the output I
  have shared below.

  Thanks,

  Rajagopal

  Input XML 

  <?xml version="1.0"?> 

  <root> 

  <content> 

  <p>Some text before</p> 

  <div> 

  <strong>First</strong> 

  <strong>Second</strong> 

   </div> 

   <div>some texts </div> 

  <div>Other text  

  <strong>ABC</strong>  

  <strong>DEF</strong>  

  <strong>IJK</strong> 

   some text nodea 

  <strong>JJJJ</strong> 

  <strong>HHH</strong> 

  </div>

  <div> 

  <strong>First</strong> 

  <strong>Second</strong> 

   </div> 

  </content> 

  </root> 

  I want the following output. I want to flatten out the <strong>
  element. 

  <?xml version="1.0"?> 

  <root> 

  <content> 

  <p>Some text before</p> 

  <div> 

  <strong>FirstSecond</strong> 

   </div> 

   <div>some texts </div> 

  <div>Other text

  <strong>ABCDEFIJK</strong> 

   some text nodes 

  <strong>JJJJHHH</strong> 

  </div>

  <div> 

  <strong>FirstSecond</strong> 

   </div> 

  </content> 

  </root>

  XSL-List info and archiveEasyUnsubscribe (by email)

XSL-List info and archiveEasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.