Subject: Re: [xsl] something like merge subparts of a branche From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 26 Apr 2005 12:13:02 -0400 |
Cheers, Wendell
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] something like merge subparts, simon litwan | Thread | [xsl] XSL-FO - Keeps & Breaks, craig webber |
Re: [xsl] An Interesting Wrinkle Re, Nadia . Swaby | Date | Re: [xsl] Revision Marking in HTML, Wendell Piez |
Month |