Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: For Each to a Comma Separated List [Thread Next] Re: For Each to a Comma Separated ListTo: NULL Date: 10/22/2009 9:26:00 AM Yes... I'm outputting to HTML... I'll have to dig into the XSLT 2.0 standard and see how much I can simplify. I am using 1.0 because my list item logic is the same as your 1.0 example. Were you able to access the attachment? "Martin Honnen" wrote: > Brian wrote: > > > Here is the simple XML Block where I want to transform the ListNode items > > into a comma separated list that gets inserted into a table cell. > > > > <XMLBlk BlkAttr="A001"> > > <NodeA>Standard</NodeA> > > <ListNode> > > <ListItem>Item 1</ListItem> > > <ListItem>Item 2</ListItem> > > <ListItem>Item 3</ListItem> > > </ListNode> > > <AnotherNode></AnotherNode> > > </XMLBlk> > > > > The list output would be "Item 1, Item 2, Item 3" > > With XSLT 2.0 creating the comma separated list is as easy as > > <xsl:template match="ListNode"> > <xsl:value-of select="ListItem" separator=", "/> > </xsl:template> > > With XSLT 1.0 you need > > <xsl:template match="ListNode"> > <xsl:for-each select="ListItem"> > <xsl:value-of select="."/> > <xsl:if test="position() != last()">, </xsl:if> > </xsl:for-each> > </xsl:template> > > > My table is somehow creates the CSL but inserts the individual items into > > what appears to be sub-cells. I get word wrapping on the "Item 1" text > > before it writes the "Item 2" text in the table cell. > > > > Question... what is the best way to structure this transform so that the > > cell just gets a CSL and wraps the content if it exceeds the width of the > > table cell? > > What kind of output do you create with the XSLT? Is that HTML? > > > -- > > Martin Honnen --- MVP XML > http://msmvps.com/blogs/martin_honnen/ > . > | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
