locked
XLST for hierarchy xml RRS feed

  • Question

  • User1366720210 posted

    I have the following xml that I need to transform into an attribute based hierarchy structure:

    <root>
    <project ID="1" description="All Projects" />
    <project ID="104" parentID="1" description="project 1" />
    <project ID="109" parentID="104" description="project 2" />
    <project ID="110" parentID="104" description="project 3" />
    <project ID="111" parentID="109" description="project 4" />
    <project ID="112" parentID="109" description="project 5" />
    <project ID="113" parentID="109" description="project 6" />

    ......

    Can anyone please show some xslt code?

    Thanks

    Tuesday, October 28, 2014 3:16 PM

Answers

  • User-1926401737 posted

    Hi samegoldinButBetter,

    As for your problem, you could refer to the following link to display XML with XSLT.

    Hope it will be helpful to you.

    Best Regards,

    Sw-ing

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 29, 2014 3:42 AM

All replies

  • User992810919 posted

    Can you please tell about the output, you want to generate?

    XSLT code will be written as per the output. AN example could be :

    <HTML>
    ....
    <Body>
    
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
               xmlns:xs="http://www.w3.org/2001/XMLSchema"
                     xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    
    
    <table border="0" cellspacing="0" cellpadding="0">
    <tr>
    <th>
    Output </th> </tr>
    <tr>
    <td>
    <xsl:for-each select="root/project">
    <xsl:value-of select="@description"/>
    <xsl:value-of select="@parentID"/>
    </xsl:for-each>
    


    </td>
    </tr> </table> <Body> </HTML>



    Wednesday, October 29, 2014 1:26 AM
  • User-1926401737 posted

    Hi samegoldinButBetter,

    As for your problem, you could refer to the following link to display XML with XSLT.

    Hope it will be helpful to you.

    Best Regards,

    Sw-ing

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, October 29, 2014 3:42 AM