xsl-list
[Top] [All Lists]

Re: [xsl] XSL, SQL, and trees (again)

2006-07-27 04:57:56

<xsl:stylesheet version="2.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:template match="directories">
    <directories>
      <xsl:apply-templates select="item[not(contains(path,'.'))]"/>
    </directories>
  </xsl:template>

  <xsl:template match="item">
    <directory name="{name}">
      <xsl:apply-templates 
select="../item[matches(path,concat('^',current()/path,'.[^\.]$'))]"/>
    </directory>
  </xsl:template>

</xsl:stylesheet>


$ saxon8 table1.xml table1.xsl \!indent=yes
<?xml version="1.0" encoding="UTF-8"?>
<directories>
   <directory name="About"/>
   <directory name="Services">
      <directory name="Environmental"/>
      <directory name="Landscaping"/>
   </directory>
</directories>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>