RE: [xsl] XSL documentor

Subject: RE: [xsl] XSL documentor
From: "James Petry" <jpetry@xxxxxxxxx>
Date: Fri, 16 Jul 2004 12:25:02 +0100
> From: Martin.Borgars@xxxxxxxxxxxxxxxxxxxxxxxx 
> 
> I've recently been given another developer's XSL templates to 
> support now that she's left the team.
> 
> There are a large number of templates. Does anyone know of 
> any tools that could provide me with details of how all the 
> templates fit together (i.e. a root map) if I tell it what 
> the top-level template is?

Christof's software sounds good, but I can't connect to his site
at the moment.

In the meantime, here's a stylesheet that I use to help
me maintain a system with 2000+ templates.

It produces a nested, static summary XML file that lists
the includes, imports, templates and call-templates.

I run a second stylesheet with that XML file as input that creates
a set of web pages with forward and back links.


<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

<xsl:output method="xml" indent="yes"/>

<xsl:template match="text()"/>

<xsl:template match="/">
  <templates>
    <xsl:apply-templates/>
  </templates>
</xsl:template>

<xsl:template match="/" mode="child">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="xsl:import">
  <import name="{@href}">
    <xsl:apply-templates select="document(@href)" mode="child"/>
  </import>
</xsl:template>

<xsl:template match="xsl:include">
  <include name="{@href}">
    <xsl:apply-templates select="document(@href)" mode="child"/>
  </include>
</xsl:template>

<xsl:template match="xsl:template">
  <template>
    <xsl:copy-of select="@name | @match"/>

    <xsl:for-each select=".//xsl:call-template">
      <calls name="{@name}"/>
    </xsl:for-each>
  </template>
</xsl:template>

</xsl:stylesheet>

Best Wishes,
James

--
"Be excellent to each other", Bill & Ted 

Current Thread