[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: unfold one element to several elements according t
mixhere wrote:
Hello everyone, is it possible to do the translation? you can add other elements/attributes in the original xml if the info is not enough. thanks. Assuming there is a common root element then the following XSLT 2.0 stylesheet does the transformation: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes"/> <xsl:template match="root"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="product"> <xsl:variable name="p" select="."/> <xsl:for-each select="tokenize(@owner, ',')"> <product id="{$p/@id}" owner="{.}"> <title> <xsl:value-of select="$p/title[tokenize(@owner, ',') = current()]"/> </title> </product> </xsl:for-each> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://JavaScript.FAQTs.com/
|
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
|