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

Re: merging the contents of consecutive

Subject: Re: merging the contents of consecutive
From: bryan rasmussen <rasmussen.bryan@xxxxxxxxx>
Date: Tue, 18 Oct 2005 22:16:08 +0200
xml uncertainty
could do that lots of different ways

how about

<xsl:template match="overview[info]">
<info><xsl:apply-templates select="info"/></info>
</xsl:template>

do whatever you want with info in an info template

your previous template should probably have been something like

<xsl:template
match="overview/info[following-sibling::*[1][local-name()='info']">
<info><xsl:value-of select="."/><xsl:text> </xsl:text><xsl:vaue-of
select="following-sibling::*[local-name()='info']"/></nfo>
</xsl:template>
and then
<xsl:template match="overview/info"/>
to get other infos out of the picture

I am however 99% certain that this is not the way you should do it ,
and instead use the other method (there is always a possiblity I don't
know some requirement you have that makes this reasonable) given this
slight hint of uncertainty I have used a rather bad xpath to get what
should have been a lot easier to get, see former example.

On 10/18/05, Annmarie Rubin (anrubin) <anrubin@xxxxxxxxx> wrote:
> Thanks for the tip, Michael.
>
> I want to generate a single element to replace two consecutive info
> elements that are children of an overview element and have the same name
> (and concatenate their contents.)  There will be no more than one pair
> of these info elements in each overview element. I don't want to
> generate a single element containing all duplicate elements.
>
> For example, this code finds the info element that is a child of an
> overview element and whose next following sibling is also an info
> element.
>
> <xsl:template match="overview/info[following-sibling::*[1][self::info]]"
> >
>
> At this point, I'm stuck. How do I concatenate both elements?
>
> thanks,
>
> Ann Marie

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.