I know that's easy, but I tried and XSLT is really non-understandable for me... That is why I would like to have an example over my code so I could examine it on real-case example and probably understand it.
So I have app that has GUI tree view and generates me XML of this sort:
<TreeView>
<Parent text="Installation">
<child text="Startup" type="video" file="startup.wmv" icon="c://user/desktop/blahblah.jpg"/>
<child text="Getting there" type="video" file="gettingthere.wmv" icontPath="something"/>
<child text="Steps" type="document" file="steps.docx" icon="asd"/>
<child text="Pictures" type="image" file="pics.jpg" icon="dasdasdas"/>
</Parent>
<Parent text="Usage">
<child text="Tilbud pane" type="video" file="tilbud.mwv" icon="asdasd"/>
<child text="Report pane" type="document" file="report.docx" icon="gfdhd"/>
</Parent>
</TreeView>
Then I need to transform this XML into HTML so I can update it in my website.
So I don't need the <html> and <body> tags. I need just the ordering of this XML into a list, whereas there should be some space before the child elements.
A desired output, viewed by the user in the browser will be like that:
Installation
Startup
Getting there
Steps
Pictures
Usage
Tilbud pane
Report pane
But because I will not have the same values in the attributes - I have to order upon the elements.
This is what I have:
<?xml version = "1.0" encoding = "utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ul>
<xsl:for-each select="Parent">
<li>
<xsl:value-of select="@text"/>
<ul>
<xsl:for-each select="Parent/child"/>
<li>
<xsl:value-of select="@text"/>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
and the desired html I have to get is smth like this:
<ul>
<li>Parent
<ul>
<li>Child</li>
<li>Child</li>
.....
</ul>
</li>
<li>Parent
<ul>
<li>Child</li>
<li>Child</li>
.....
</ul>
</li>
.....
</ul>
but apparently it doesn't want to give me this... It gives me just <ul/> after I run the transformation...