[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] How to get elements in a row?
Hi, How I can get elements in a comma separated row without last comma and header line? Each item should have its features (one, two, three, four) but also its parent (sample1). I am using xalan java processor 2.2.d13. Wanted Output ****************************************************** sample1,item1,one,two sample1,item2,three,four ****************************************************** Current Output ****************************************************** <?xml version="1.0" encoding="UTF-8"?> sample1, item1, one, two, item2, three, four, ****************************************************** XML ****************************************************** <?xml version="1.0" encoding="UTF-8"?> <samples> <sample id = "1"> <name>sample1</name> <items> <item id = "1"> <name>item1</name> <features> <feature id = "1"> <name>one</name> </feature> <feature id = "2"> <name>two</name> </feature> </features> </item> <item id = "12"> <name>item2</name> <features> <feature id = "3"> <name>three</name> </feature> <feature id = "4"> <name>four</name> </feature> </features> </item> </items> </sample> </samples> ****************************************************** XSL ****************************************************** <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="samples"> <xsl:apply-templates select="sample"/> </xsl:template> <xsl:template match="sample"> <xsl:apply-templates select = "name"/> <xsl:apply-templates select = "items"/> </xsl:template> <xsl:template match="items"> <xsl:apply-templates select="item"/> </xsl:template> <xsl:template match="item"> <xsl:apply-templates select = "name"/> <xsl:apply-templates select = "features"/> </xsl:template> <xsl:template match="features"> <xsl:apply-templates select="feature"/> </xsl:template> <xsl:template match="feature"> <xsl:apply-templates select = "name"/> </xsl:template> <xsl:template match="name"> <xsl:value-of select = "."/>, </xsl:template> </xsl:stylesheet> ****************************************************** Thanks in advance! Marko 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
|