Subject: RE: [xsl] Looping and assigning into variable From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Thu, 28 Mar 2002 16:54:02 -0000 |
> How can I do this in XSLT? Not by trying to update a variable, that's not the way XSLT works. Do it like this: <xsl:variable name="commentVar"> <xsl:for-each select="Header"> <xsl:value-of select="Comment"/> </xsl:for-each> </xsl:variable> <Comments> <xsl:value-of select="$commentVar"/> </Comments> Of course, you might not need a variable at all, you can just do the xsl:for-each inside the <Comments> element. In XPath 2.0 / Saxon 7.0, you can just do: <Comments> <xsl:value-of select="Header/Comment" separator=""/> </Comments> Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > > <xsl: variable name="CommentVar"/> > > <xsl:for-each select="Header"> > > <!-- here i would like to get the current 'Comment' > value and > concatenate with the previous comment value > through above 'CommentVar', something like below--> > <xsl:value-of > select="CommentVar=concat(Comment,$CommentVar)"/> > > </xsl:for-each> > > <!-- here I would like to get the concatenated list of all > 'Comment' values --> > <Comments> > <xsl:value-of select="$CommentVar"/> > </Comments> > > 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 > > > Thanks in advance.. > VENKAT > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Looping and assigning int, Jeni Tennison | Thread | RE: [xsl] Looping and assigning int, Venkateshwar Bommine |
RE: [xsl] Looping and assigning int, Venkateshwar Bommine | Date | RE: [xsl] problem with transforming, Michael Kay |
Month |