My Sample XML:
Expand|Select|Wrap|Line Numbers
- <root name="PlanRepository">
- <directory name="connoraj">
- <directory name="single_run.dat.07-23-2007.10-59-51">
- <file>insidebox.txt</file>
- <file>outsidebox.txt</file>
- <directory name="SAFE_Input">
- <file>leapseconds.txt</file>
- <file>single_run.dat</file>
- <directory name="LeoInputs">
- <file>control_earth.txt</file>
- <file>leo_sc_prop2.txt</file>
- </directory>
- </directory>
- <directory name="SAFE_Output">
- <file>single_run.aer.dat</file>
- <file>single_run.control_files</file>
- <file>single_run.dv.dat</file>
- <file>single_run.est_pv.dat</file>
- <file>single_run.host_ephem.e</file>
- <file>single_run.host_inertial.dat</file>
- <file>single_run.residuals.dat</file>
- <file>single_run.tar_ephem.e</file>
- <file>single_run.tar_inertial.dat</file>
- <file>single_run.true_pv.dat</file>
- </directory>
- </directory>
- </directory>
- </root>
Expand|Select|Wrap|Line Numbers
- <xsl:template match="root">
- <xsl:copy>
- <xsl:attribute name="name">PlanRepository</xsl:attribute>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="directory">
- <xsl:copy>
- <xsl:copy-of select="@name"/>
- <xsl:choose>
- <xsl:when test="@name = 'SAFE_Output'">
- <xsl:for-each select="file">
- <xsl:sort select="substring-after(substring-after(.,'.'),'.')" />
- <xsl:copy-of select="."/>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:for-each select="file">
- <xsl:sort select="substring-after(.,'.')" />
- <xsl:copy-of select="."/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:apply-templates select="directory"/>
- </xsl:copy>
- </xsl:template>
Expand|Select|Wrap|Line Numbers
- insidebox.txtoutsidebox.txtsingle_run.datleapseconds.txtcontrol_earth.txtleo_sc_prop2.txtsingle_run.control_filessingle_run.aer.datsingle_run.dv.datsingle_run.est_pv.datsingle_run.host_inertial.datsingle_run.residuals.datsingle_run.tar_inertial.datsingle_run.true_pv.datsingle_run.host_ephem.esingle_run.tar_ephem.e
Expand|Select|Wrap|Line Numbers
- <root name="PlanRepository">
- <directory name="connoraj">
- <directory name="single_run.dat.07-23-2007.10-59-51">
- <file>insidebox.txt</file>
- <file>outsidebox.txt</file>
- <directory name="SAFE_Input">
- <file>single_run.dat</file>
- <file>leapseconds.txt</file>
- <directory name="LeoInputs">
- <file>control_earth.txt</file>
- <file>leo_sc_prop2.txt</file>
- </directory>
- </directory>
- <directory name="SAFE_Output">
- <file>single_run.control_files</file>
- <file>single_run.aer.dat</file>
- <file>single_run.dv.dat</file>
- <file>single_run.est_pv.dat</file>
- <file>single_run.host_inertial.dat</file>
- <file>single_run.residuals.dat</file>
- <file>single_run.tar_inertial.dat</file>
- <file>single_run.true_pv.dat</file>
- <file>single_run.host_ephem.e</file>
- <file>single_run.tar_ephem.e</file>
- </directory>
- </directory>
- </directory>
- </root>
Thanks,
Andrew