I have a very simple XML:
[pre]<?xml version="1.0" encoding="UTF-8"?>
<nav title="Containerized IP Office J100 Series Phone User Guide"
homepage="Introduction.html">
<nav title="Introduction" href="Introduction.html">
<nav title="Important Safety Information" href="Important_Safety_Information.html"/>
<nav title="J129 Telephone" href="J129_Telephone.html"/>
<nav title="J139 Telephone" href="J139_Telephone.html"/>
<nav title="Appearance Buttons" href="Appearance_Buttons.html">
<nav title="Call Appearance Buttons" href="Call_Appearance_Buttons.html"/>
<nav title="Line Appearance Buttons" href="Line_Appearance_Buttons.html"/>
</nav>
<nav title="Programmable Feature Buttons" href="Feature_Buttons.html"/>
<nav title="Status Display" href="Status_Display.html">
<nav title="Status Icons" href="Status_Icons.html"/>
<nav title="Status Letters" href="Status_Letters.html"/>
</nav>
<nav title="Icons" href="Icons.html"/>
<nav title="The Phone Stand" href="The_Phone_Stand.html"/>
</nav>
...[/pre]
I need to turn it into an HTML list with <ul> and <li> tags. However, being very much a novice, I am struggling to cope with the fact that some of the <nav> tags in the source contain other <nav> tags as child nodes.
The following works in part for the parent nodes when set to match 'nav' and for the child nodes when set to match 'nav/nav'.
[pre]<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl=" version="2.0">
<xslutput method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<hmtl><head><title>Test</title></head>
<ul><xsl:apply-templates/></ul>
</hmtl>
</xsl:template>
<xsl:template match="nav">
<xsl:for-each select="nav">
<li><p><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@title"/>
</xsl:element></p></li>
</xsl:for-each>
</xsl:template>
</xsl:transform>[/pre]
Stuck in a never ending cycle of file copying.
[pre]<?xml version="1.0" encoding="UTF-8"?>
<nav title="Containerized IP Office J100 Series Phone User Guide"
homepage="Introduction.html">
<nav title="Introduction" href="Introduction.html">
<nav title="Important Safety Information" href="Important_Safety_Information.html"/>
<nav title="J129 Telephone" href="J129_Telephone.html"/>
<nav title="J139 Telephone" href="J139_Telephone.html"/>
<nav title="Appearance Buttons" href="Appearance_Buttons.html">
<nav title="Call Appearance Buttons" href="Call_Appearance_Buttons.html"/>
<nav title="Line Appearance Buttons" href="Line_Appearance_Buttons.html"/>
</nav>
<nav title="Programmable Feature Buttons" href="Feature_Buttons.html"/>
<nav title="Status Display" href="Status_Display.html">
<nav title="Status Icons" href="Status_Icons.html"/>
<nav title="Status Letters" href="Status_Letters.html"/>
</nav>
<nav title="Icons" href="Icons.html"/>
<nav title="The Phone Stand" href="The_Phone_Stand.html"/>
</nav>
...[/pre]
I need to turn it into an HTML list with <ul> and <li> tags. However, being very much a novice, I am struggling to cope with the fact that some of the <nav> tags in the source contain other <nav> tags as child nodes.
The following works in part for the parent nodes when set to match 'nav' and for the child nodes when set to match 'nav/nav'.
[pre]<?xml version="1.0" encoding="UTF-8" ?>
<xsl:transform xmlns:xsl=" version="2.0">
<xslutput method="html" doctype-public="XSLT-compat" omit-xml-declaration="yes" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<hmtl><head><title>Test</title></head>
<ul><xsl:apply-templates/></ul>
</hmtl>
</xsl:template>
<xsl:template match="nav">
<xsl:for-each select="nav">
<li><p><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="@title"/>
</xsl:element></p></li>
</xsl:for-each>
</xsl:template>
</xsl:transform>[/pre]
Stuck in a never ending cycle of file copying.