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

Re: something like merge subparts of a branche

Subject: Re: something like merge subparts of a branche
From: simon litwan <simon.litwan@xxxxxxxxx>
Date: Wed, 27 Apr 2005 12:07:03 +0200
important.gif
hi wendell

thanks very much for your help. it makes me feel good if you say it's a
tough one. i tried so long and felt quit stupid:-)
cheers
simon

> Simon,
> 
> Your problem is a tough one; for whatever reason (it'd be interesting to 
> know) it's lately been coming up with increasing frequency. It was even 
> discussed on the list not long ago -- see
> 
> http://www.biglist.com/lists/xsl-list/archives/200504/msg00620.html
> 
> and the cascade of messages following.
> 
> The short version: you have a range of options, including a couple of 
> techniques (key-driven grouping by proximity; "tree walking") that are more 
> complex than most standard techniques in XSLT 1.0, as well as the 
> widely-disparaged "tag writing" solution. Alternatively, you might also be 
> able to design around this requirement (XSLT 1.0 was designed for more 
> straightforward "down-conversions") either by changing the design of your 
> source or your target. And finally, XSLT 2.0 presents better options for 
> handling this kind of thing....
> 
> If I had to solve this in XSLT 1.0 I'd probably use the "tree-walking" 
> technique but I might opt to group by proximity using keys.
> 
> I hope this helps.
> 
> Cheers,
> Wendell
> 
> At 05:25 AM 4/26/2005, you wrote:
> >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
> 
> 
> ======================================================================
> Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
> Mulberry Technologies, Inc.                http://www.mulberrytech.com
> 17 West Jefferson Street                    Direct Phone: 301/315-9635
> Suite 207                                          Phone: 301/315-9631
> Rockville, MD  20850                                 Fax: 301/315-8285
> ----------------------------------------------------------------------
>    Mulberry Technologies: A Consultancy Specializing in SGML and XML
> ======================================================================

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.