[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: how to merge tags/nodes via transform?
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()<=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()>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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|