Subject: RE: [xsl] Looping and assigning into variable From: "Venkateshwar Bommineni" <vbommineni@xxxxxxxxxx> Date: Thu, 28 Mar 2002 11:31:19 -0500 |
Hi Jeni, Actually I had to concatenate 2 child elements for each header and concatente result with previous one. So according to your suggestion I have to do like, <Comments> <xsl:for-each select="Header"> <xsl:value-of select="concat(RefNo,Comment)" /> </xsl:for-each> </Comments> Is that correct? So Is it good way to apply template on same match, mutiple times in the same document as : <xsl:for-each select="Header"> -- do some thing -- </xsl:for-each> <Comments> <xsl:for-each select="Header"> <xsl:value-of select="concat(RefNo,Comment)" /> </xsl:for-each> </Comments> I had the impression that XSLT processor parses input XML in SAX manner thus it matches an Element and applies relavant template only once. Am I wrong? Thanks for your help >>VENKAT -----Original Message----- From: Jeni Tennison [mailto:jeni@xxxxxxxxxxxxxxxx] Sent: Thursday, March 28, 2002 11:12 AM To: Venkateshwar Bommineni Cc: XSL-List@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Looping and assigning into variable Hi Venkat, > Basically Each 'Header' element has 1 'Comment' child element in it. > So I have to loop through all headers and finally get the complete > list of concatenated 'Comment's Just do: <Comments> <xsl:for-each select="Header"> <xsl:value-of select="Comment" /> </xsl:for-each> </Comments> In other words, construct the concatenated list of comments when you need the concatenated list of comments, don't try to build it at the same time as doing something else. It's very hard doing two things at once with XSLT. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Looping and assigning int, Michael Kay | Thread | RE: [xsl] Looping and assigning int, Michael Kay |
[xsl] RegEx in XSLT?, Jakub . Valenta | Date | RE: [xsl] Looping and assigning int, Michael Kay |
Month |