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

Re: how to merge tags/nodes via transform?

Subject: Re: how to merge tags/nodes via transform?
From: Jarkko.Moilanen@xxxxxx
Date: Mon, 12 Aug 2002 12:20:29 +0300 (EEST)
merge tags xml
Another solution...still not too efficient or "wise" =)


<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"

version = "1.0" >

    <xsl:output method = "xml" indent = "yes" />
	
      <xsl:template match = "root" >
	<root>
	<b>
	<xsl:for-each select="b">
	<xsl:if test="position()&lt;=3">
	 <xsl:value-of select="." />
	 </xsl:if>
	 </xsl:for-each>
	</b>
	<xsl:text> and </xsl:text>

	<b>
	<xsl:for-each select="b">
	<xsl:if test="position()&gt;3">
	 <xsl:value-of select="." />
	 </xsl:if>
	 </xsl:for-each>
	</b>
	</root>
		
	</xsl:template>
</xsl:stylesheet>



Lainaus Jarkko.Moilanen@xxxxxx:

> Lainaus rbondi@xxxxxxxxxx:
> 
> > Could someone please suggest a template to convert e.g.:
> 
> Dummy solution:
> 
> <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
> version = "1.0" >
> 
>     <xsl:output method = "xml" indent = "yes" />
> 	
>       <xsl:template match = "root" >
> 	<root>
> 	<b>
>         <//select 1 to 3 <b> - elements
>         <xsl:value-of select="b[1]" />
> 	<xsl:value-of select="b[2]" />
> 	<xsl:value-of select="b[3]" />
> 	</b>
> 	<xsl:text>and</xsl:text>
> 	
> 	<b>
> 	 <xsl:value-of select="b[4]" />
> 	 <xsl:value-of select="b[5]" />
> 	<xsl:value-of select="b[6]" />
> 	<xsl:value-of select="b[7]" />
> 	</b>
> 	</root>
> 	
> 		
> 	</xsl:template>
> </xsl:stylesheet>
> 
> 
> 
> 
> > 
> > <root>
> >  <b>d</b>
> >  <b>o</b>
> >  <b>g</b>
> > and
> >  <b>c</b>
> >  <b>a</b>
> >  <b>t</b>
> >  <b>s</b>
> > </root>
> > 
> > into
> > 
> > <root>
> >  <b>dog</b>
> >  and
> >  <b>cats</b>
> > </root>
> > 
> > Many thanks in advance,
> > Richard Bondi
> > 
> > 
> > 
> > 
> > 
> >  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> > 
> > 
> 
> 
> 
> ****************************************************************
> Jarkko Moilanen          "Erehtyminen on inhimillista, 
> Researcher/ ITCM         mutta todella suuret mokat 
> jm60697@xxxxxx           vaativat tietokoneen käyttöä."         
> www.uta.fi/~jm60697                                           
> GSM: +358 50 3766 927                                         
> ****************************************************************
> * ITCM | Information Technology and Crisis Management            
> * http://www.itcm.org                                            
> ****************************************************************
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 



****************************************************************
Jarkko Moilanen          "Erehtyminen on inhimillista, 
Researcher/ ITCM         mutta todella suuret mokat 
jm60697@xxxxxx           vaativat tietokoneen käyttöä."         
www.uta.fi/~jm60697                                           
GSM: +358 50 3766 927                                         
****************************************************************
* ITCM | Information Technology and Crisis Management            
* http://www.itcm.org                                            
****************************************************************

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.