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

something like merge subparts of a branche

Subject: something like merge subparts of a branche
From: simon litwan <simon.litwan@xxxxxxxxx>
Date: Tue, 26 Apr 2005 11:25:49 +0200
something like simon
hi list

i'm pretty new to xsl and try to solve a problem that goes over my
abilities. but maybe somebody can help me.
i'm working with apache-lenya.
the problem is like this.
i have a source tree like this.

<p>
   <a href="http://www.hello.ch/" title="">
     minus eins und null
   </a>
   <object data="important.gif" href="" title="important"
type="image/gif">erstes</object>
   <a href="http://www.hello.ch/" title="">
     eins zwei
   </a>
   drei und noch was
   <object data="important.gif" href="" title="important"
type="">zweites</object>
   vier und noch mehr
   <a href="http://www.hello.ch/" title="">
     fuenf sechs
   </a>
</p>

and the result should be like this:

<p>
   <a href="http://www.hello.ch/" title="">
     minus eins und null
   </a>
</p>
<p>
   <object data="important.gif" href="" title="important"
type="image/gif">erstes</object>
</p>
<p>
   <a href="http://www.hello.ch/" title="">
     eins zwei
   </a>
   drei und noch was
</p>
<p>
   <object data="important.gif" href="" title="important"
type="">zweites</object>
</p>
<p>
   vier und noch mehr
   <a href="http://www.hello.ch/" title="">
     fuenf sechs
   </a>
</p>

at the moment my xsl looks like that.

  <xsl:template match="xhtml:p[xhtml:object]" priority="3">

    <xsl:choose>
      <xsl:when test="node()[not(self::xhtml:object) and
normalize-space() != '']">
        
        <xsl:for-each select="node()">
          <xsl:choose>
            <xsl:when test="self::xhtml:object">
       
              <xsl:apply-templates
select="self::xhtml:object"></xsl:apply-templates>
            
            </xsl:when>
            <xsl:otherwise>
            <p>
              <xsl:apply-templates select="."></xsl:apply-templates>
            </p>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>
        
      </xsl:when>
      <xsl:otherwise>
      
        <xsl:apply-templates select="xhtml:object"/> 
      
      </xsl:otherwise>
    </xsl:choose>
    
  </xsl:template>


but it's certainly not like that. i do not know how to merge the all
siblings befor an xhtml:object under a paragraf but not the
xhtml:object. and then merge again the nodes between the xhtml:object
and so on.

i tried different ways. 
for example a for-each for each xhtml:object and then get the siblings
around xhtml:object with preceding-sibling/following-sibling. the
problem with this aproach is that if there ar several xhtml:object in
the paragraph i don't know how to limit the following-sibling just to
the next xhtml:object.

i'm not sure my explanation is good enough.
anyway thanks for any help.
simon

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.