Subject: [xsl] Transforming XML to XML (diff. format) using XSL From: vipul.vij@xxxxxxxxxxxx Date: Tue, 3 Jun 2003 11:47:25 +0100 |
Hello to you all, I am using the following XSL processor: Vendor: Microsoft Vendor URL: http://www.microsoft.com I trying to transform a XML file (created from a MySQL DB) into another XML file listing FIXED bug details in a table and a brief description in an order list . Problem: how do I use <xsl:for-each select=""> to refer to each of the field names in the source? I would like to say display the value of "bug_id" inside the <li> tag within a ordered list and create a hyperlink to the bug page inside the table . Please look at my XSL file. Here is a snippet of the source XML: <?xml version="1.0"?> <mysqldump> <database name="bugtracker"> <table name="phpbt_bug"> <row> <field name="bug_id">1</field> <field name="title">Contacts Disappearing from Distribution Lists</ field> <field name="description">If a contact us updated from the &quot;Edit Contact&quot; screen then they are somehow removed from any distribution lists they were on.</field> <field name="url"/> <field name="severity_id">5</field> <field name="priority">1</field> <field name="status_id">7</field> <field name="resolution_id">1</field> <field name="database_id">0</field> <field name="site_id">0</field> <field name="assigned_to">5</field> <field name="created_by">1</field> <field name="created_date">1049903813</field> <field name="last_modified_by">1</field> <field name="last_modified_date">1052321523</field> <field name="project_id">1</field> <field name="version_id">6</field> <field name="component_id">5</field> <field name="os_id">1</field> <field name="browser_string">Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)</field> <field name="close_date">1052321523</field> <field name="closed_in_version_id">12</field> <field name="to_be_closed_in_version_id">12</field> </row> <row> [A lot more rows....................................................] ========================================================================================================== My XSL file: <xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/> <xsl:template match="/"> <xml> <document> <properties><author email="vipul.vij@xxxxxxxxxx">Vipul Vij</ author></properties> <body> <section name= "Bugs fixed"> <p>Summary of bugs that have been now fixed</p> <xsl:for-each select="mysqldump/database/table/row"> <! --*********************************************************************--> <xsl:for-each select="field"> <!-- THIS IS NOT READING AND CREATING THE ORDER LIST --> <xsl:sort select="bug_id"/> <!-- *********************************************************************--> <xsl:if test= "status_id='7'"> <xsl:if test="resolution='1'"> <ol> <li><xsl:value-of select="title"/></li> </ol> </xsl:if> </xsl:if> </xsl:for-each> </xsl:for-each> <table> <tr> <td>Bug ID</td> <td>Name</td> <td>Description</td> <td>Fixed by</td> </tr> <xsl:for-each select="mysqldump/database/table/row"> <!-- ********************************************************************* --> <xsl:sort select="bug_id"/> <!-- NOT READ IN CORRECTLY AND NOT CREATING TABLE <xsl:if test="status_id=7"> <!-- ROWS --> <xsl:if test="resolution=1"> <tr> <td><A HREF= " http://intranet/phpbt-0.9.1/bug.php?op=show&bugid="><xsl:value-of select="bug_id"/><xsl:value-of select="bug_id"/></A></td> <td><xsl:value-of select="title"/></td> <!--- Need to use <p> tags</p> in description--> <td><xsl:value-of select="description"/></ td> <td><A HREF="mailto:vipul.vij@xxxxxxxxxx"> Vipul Vij</A></td> </tr> </xsl:if> </xsl:if> </xsl:for-each> </table> </section> </body> </document> </xml> </xsl:template> </xsl:stylesheet> =========================================================================================================================================================== Your help will be appreciated. Regards, Vipul Vij XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:sort for the first ch, David Carlisle | Thread | Re: [xsl] Transforming XML to XML (, David Carlisle |
Re: [xsl] xsl:sort for the first ch, David Carlisle | Date | RE: [xsl] Transforming XML to XML (, Jarno . Elovirta |
Month |